Comparing version 3.0.0 to 3.0.1
@@ -6,2 +6,33 @@ Change Log | ||
3.0.1 | ||
----- | ||
Released: 2022-03-05 | ||
### Minor Changes | ||
- [#329](https://github.com/peggyjs/peggy/issues/329) Allow plugin options in | ||
generate. This change loosens type checking strictness to allow for options | ||
unknown to Peggy, but used by plugins such as ts-pegjs. From @hildjj. | ||
### Bug Fixes | ||
- [#329](https://github.com/peggyjs/peggy/issues/329) Allow type definition for ParserBuildOptions to include plugin options. From @hildjj. | ||
- [#346](https://github.com/peggyjs/peggy/issues/346) Allow extra semicolons | ||
between rules. From @hildjj. | ||
- [#347](https://github.com/peggyjs/peggy/issues/347) Disallow '$' as an initial | ||
character in identifiers. This is not a breaking change because no grammar | ||
could have successfully used these in the past. From @hildjj. | ||
- [#354](https://github.com/peggyjs/peggy/pull/354) Various minor nits in the | ||
docs, including indentation and ensuring that the CNAME file is correct. | ||
- [#357](https://github.com/peggyjs/peggy/issues/357) Fix infinite recursion | ||
possibility in repetition delimeters. From @hildjj and @Mingun. | ||
- [#359](https://github.com/peggyjs/peggy/issues/359) Do not treat as many | ||
words as reserved. Clarify the documentation about identifiers. Ensure | ||
that it is more clear that the target language being generated determines | ||
what words are reserved. Clarify that reserved word checking is only | ||
done for labels. From @nene. | ||
- [#364](https://github.com/peggyjs/peggy/issues/364) Fix passing an incorrect | ||
external label to the expression inside the `repeated` node. From @Mingun. | ||
3.0.0 | ||
@@ -88,3 +119,3 @@ ----- | ||
[SemVer.org](https://semver.org) semantic version string, from @dselman | ||
- [[#307](https://github.com/peggyjs/peggy/issues/307)] Allow grammars to have | ||
- [#307](https://github.com/peggyjs/peggy/issues/307) Allow grammars to have | ||
relative offsets into their source files (e.g. if embedded in another doc), | ||
@@ -91,0 +122,0 @@ from @hildjj. |
@@ -900,3 +900,3 @@ "use strict"; | ||
const expressionCode = generate(node.expression, { | ||
const firstExpressionCode = generate(node.expression, { | ||
sp: maxCode.sp + offset, | ||
@@ -906,2 +906,10 @@ env: cloneEnv(context.env), | ||
}); | ||
const expressionCode = node.delimiter !== null | ||
? generate(node.expression, { | ||
// +1 for the saved position before parsing the `delimiter elem` pair | ||
sp: maxCode.sp + offset + 1, | ||
env: cloneEnv(context.env), | ||
action: null, | ||
}) | ||
: firstExpressionCode; | ||
const bodyCode = buildRangeBody( | ||
@@ -919,4 +927,4 @@ node.delimiter, | ||
const firstElemCode = hasBoundedMax | ||
? buildCheckMax(expressionCode, node.max) | ||
: expressionCode; | ||
? buildCheckMax(firstExpressionCode, node.max) | ||
: firstExpressionCode; | ||
const mainLoopCode = buildSequence( | ||
@@ -923,0 +931,0 @@ // If the low boundary present, then backtracking is possible, so save the current pos |
@@ -29,5 +29,11 @@ "use strict"; | ||
repeated(node) { | ||
// No need to check min or max. They can only be numbers, variable | ||
// names, or code blocks. | ||
if (node.delimiter) { | ||
check(node.delimiter); | ||
} | ||
if (asts.alwaysConsumesOnSuccess(ast, node.expression) | ||
|| node.delimiter && asts.alwaysConsumesOnSuccess(ast, node.delimiter) | ||
) { | ||
|| (node.delimiter | ||
&& asts.alwaysConsumesOnSuccess(ast, node.delimiter))) { | ||
return; | ||
@@ -34,0 +40,0 @@ } |
@@ -1189,2 +1189,8 @@ // Based on PEG.js Type Definitions by: vvakame <https://github.com/vvakame>, Tobias Kahlert <https://github.com/SrTobi>, C.J. Bell <https://github.com/siegebell> | ||
/** | ||
* Extensions may need to the caller to pass in otherwise-unknown options. | ||
* ts-pegjs has an example in its README.md. | ||
*/ | ||
[extensionOpts: string]: any; | ||
/** | ||
* If set to `"parser"`, the method will return generated parser object; | ||
@@ -1191,0 +1197,0 @@ * if set to `"source"`, it will return parser source code as a string; |
@@ -67,31 +67,37 @@ "use strict"; | ||
// The following are reserved as future keywords by older ECMAScript | ||
// specifications | ||
"abstract", | ||
"boolean", | ||
"byte", | ||
"char", | ||
"double", | ||
"final", | ||
"float", | ||
"goto", | ||
"int", | ||
"long", | ||
"native", | ||
"short", | ||
"synchronized", | ||
"throws", | ||
"transient", | ||
"volatile", | ||
// The following are reserved as future keywords by ECMAScript 1..3 | ||
// specifications, but not any more in modern ECMAScript. We don't need these | ||
// because the code-generation of Peggy only targets ECMAScript >= 5. | ||
// | ||
// - abstract | ||
// - boolean | ||
// - byte | ||
// - char | ||
// - double | ||
// - final | ||
// - float | ||
// - goto | ||
// - int | ||
// - long | ||
// - native | ||
// - short | ||
// - synchronized | ||
// - throws | ||
// - transient | ||
// - volatile | ||
// These are not reserved keywords, but using them as variable names is problematic. | ||
"arguments", // Conflicts with a special variable available inside functions. | ||
"eval", // Redeclaring eval() is prohibited in strict mode | ||
// A few identifiers have a special meaning in some contexts without being | ||
// reserved words of any kind. They include: | ||
"arguments", | ||
"as", | ||
"async", | ||
"eval", | ||
"from", | ||
"get", | ||
"of", | ||
"set", | ||
// reserved words of any kind. These we don't need to worry about as they can | ||
// all be safely used as variable names. | ||
// | ||
// - as | ||
// - async | ||
// - from | ||
// - get | ||
// - of | ||
// - set | ||
]; | ||
@@ -98,0 +104,0 @@ |
@@ -9,2 +9,2 @@ | ||
module.exports = "3.0.0"; | ||
module.exports = "3.0.1"; |
{ | ||
"name": "peggy", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Parser generator for JavaScript", | ||
@@ -63,16 +63,16 @@ "keywords": [ | ||
"@types/jest": "^29.4.0", | ||
"@types/node": "^18.14.0", | ||
"@typescript-eslint/eslint-plugin": "^5.53.0", | ||
"@typescript-eslint/parser": "^5.53.0", | ||
"@types/node": "^18.14.6", | ||
"@typescript-eslint/eslint-plugin": "^5.54.0", | ||
"@typescript-eslint/parser": "^5.54.0", | ||
"chai": "^4.3.7", | ||
"chai-like": "^1.1.1", | ||
"copyfiles": "^2.4.1", | ||
"eslint": "^8.34.0", | ||
"eslint": "^8.35.0", | ||
"express": "4.18.2", | ||
"jest": "^29.4.3", | ||
"rimraf": "^4.1.2", | ||
"rollup": "^3.17.2", | ||
"rimraf": "^4.3.0", | ||
"rollup": "^3.18.0", | ||
"rollup-plugin-ignore": "1.0.10", | ||
"source-map": "^0.8.0-beta.0", | ||
"terser": "^5.16.4", | ||
"terser": "^5.16.5", | ||
"ts-jest": "^29.0.5", | ||
@@ -79,0 +79,0 @@ "tsd": "^0.25.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
484145
9268