1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-26 20:28:49 +08:00
Commit Graph

22 Commits

Author SHA1 Message Date
Steven Hartland
98effe01d8
chore: update ci versions (#519)
Update go, golangci-lint and action versions.

Address new lint failures flagged by updated golangci-lint version.
2024-04-13 17:05:50 +01:00
Tomoki Yamaguchi
11288b7564
fix: positions of statements (#506)
Fix the positions of various statements:
* Fix Idx1 of BranchStatement so that it points to the character after the label if Label exists,
  or the one after Token if Label does not exist.
* Fix Idx1 of LabelledStatement so that it points to the character after the statement.
* Fix Idx1 of ReturnStatement so that it points to the character after the argument if
  Argument exists, or the one after return keyword if Argument does not exist.
* Set Idx0 of SwitchStatement and fix Idx1 of SwitchStatement so that it points to the
  character after the right brace.
* Fix Idx0 of ThrowStatement to point to the start of throw keyword and fix Idx1 of
  ThrowStatement so that it points to the next character after Argument.
* Fix Idx1 of TryStatement to point to the character after Finally if Finally exists, or after Catch
  if Finally does not exist.
* Set Idx0 of WithStatement which was not previously set.
* Set WhileStatement.While so that Idx0 points to the right place.
* Set Idx0 of DoWhileStatement and fix Idx1 to point to the next character after the right
  parenthesis.
2023-07-25 18:25:01 +01:00
Tomoki Yamaguchi
03572093ec
fix: starting positions of for and for-in statements (#503)
Fix Idx0 of ForStatement and ForInStatement to point to the right place which were previously not set.
2023-07-18 10:42:59 +01:00
Tomoki Yamaguchi
f70d418ad2
fix: starting position of if statement (#501)
Fix IfStatement Idx0 to point to the right place. I was pointing to the right parenthesis
after the test expression.
2023-07-17 22:27:09 +01:00
Steven Hartland
5d81e9e02d
chore: rename _parser (#483)
Rename _parser -> parser missed in previous refactor.
2022-12-07 00:23:10 +00:00
Steven Hartland
026a1d9a9c
chore: lint and naming refactor (#475)
Enable more linters, address the issues and do a major naming refactor
to use golang lower camelCase identifiers for types, functions, methods
and variable names.

Also: 
* Clean up inline generation so it doesn't rely on temporary variables.
* Remove unused functions generated by inline.pl.
2022-12-04 21:49:38 +00:00
Steven Hartland
a5b0adea00
Allow semicolon in nested do-while statements. (#463)
In nested do-while statements, a semicolon after the inner `while` threw
a parsing error. This change checks for the optional semicolon.

Co-authored-by: Brian Graham <bcgraham+github@gmail.com>
2022-11-28 11:25:15 +00:00
Steven Hartland
a3b51c68f2
chore: enable whitespace linter and fix errors (#456)
Enable the whitespace linter and fix the errors resulting from it.

Also:
* Remove unneeded golangci-lint config for disabled linters.
* Correct test number for panic in previous commit.
2022-11-26 13:33:09 +00:00
Iskander (Alex) Sharipov
edceeed7a9
fix: remove commented-out code (#323)
Remove old commented out code that was found using:
https://go-critic.github.io/overview.html#commentedOutCode-ref
2021-09-27 16:31:07 +01:00
carterjones
6c383dd335 fix whitespace issues (#297) 2018-03-05 04:20:45 +00:00
Tao Wen
3b44b4dcb6 fix idx of throw and if (#286)
* fix idx of throw and if

* add test to cover if/throw statement idx
2017-11-30 10:32:05 +00:00
wolfgarnet
ab433a4a50 Improved comment map
* More precise
* Line break special cases supported
* Less intrusive
2016-02-22 15:16:41 +01:00
wolfgarnet
3b2178bf55 Added FunctionStatement 2016-02-19 13:14:42 +01:00
wolfgarnet
54a2be367f [#148] Fixed style 2016-01-12 12:13:04 +01:00
wolfgarnet
9f65b62899 [#148] Grouped statements 2016-01-12 11:14:02 +01:00
wolfgarnet
c356c94888 [#148] Do not make context switch if not necessary 2016-01-12 11:02:09 +01:00
wolfgarnet
36da11f822 [#148] Removed temporary comment variables 2016-01-11 09:16:46 +01:00
wolfgarnet
af88758381 [#148] Storing comments to a commentmap 2015-12-17 13:50:33 +01:00
Robert Krimen
e6768252c2 Improve error reporting
* Delay entering global scope on code evaluation, not runtime creation

This fixes #66
2014-06-12 21:27:32 -07:00
Robert Krimen
bf7b16f4a3 Add internal compilation step
* Streamline what we get from "otto/parser"
* Get rid of some "otto/parser" cruft
* FunctionExpression => FunctionLiteral
* The debugger statement (debugger) should do nothing (not panic)
* Fix aspects of function expression call evaluation
2014-04-19 14:05:51 -07:00
Robert Krimen
8aca2c886a Disable script marshalling/unmarshalling for now 2014-04-15 18:34:24 -07:00
Robert Krimen
ad8a97c028 New parser
* Faster, more straightforward, etc.
* More advanced object literals (get ..., set ...)
* More tests using JavaScript from the wild (http://cdnjs.com/)
2014-04-10 20:42:25 -07:00