Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ let regex = regjsgen.generate(ast);
## Support

Tested on Node.js 16, 18, 20, and 22.<br>
Compatible with regjsparser v0.12.0’s AST.
Compatible with regjsparser v0.14.0’s AST.


[ci]: https://github.com/bnjmnt4n/regjsgen/actions
Expand Down
30 changes: 15 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
},
"devDependencies": {
"nyc": "^18.0.0",
"regjsparser": "^0.12.0"
"regjsparser": "^0.14.0"
}
}
6 changes: 6 additions & 0 deletions regjsgen.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@
return '\\b';
case 'not-boundary':
return '\\B';
case 'start-buffer':
return '\\A';
case 'end-buffer':
return '\\z';
case 'end-buffer-optional-newline':
return '\\Z';
default:
throw Error('Invalid assertion');
}
Expand Down
5 changes: 5 additions & 0 deletions tests/error-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,8 @@ testGenerates(
{ 'type': 'alternative', 'body': [symbol('1'), value('null', 0)] },
'1\\0'
);

// Buffer boundary anchors.
testGenerates('start-of-buffer anchor', { 'type': 'anchor', 'kind': 'start-buffer' }, '\\A');
testGenerates('end-of-buffer anchor', { 'type': 'anchor', 'kind': 'end-buffer' }, '\\z');
testGenerates('end-of-buffer anchor with an optional newline', { 'type': 'anchor', 'kind': 'end-buffer-optional-newline' }, '\\Z');
Loading
Loading