Skip to content

Commit

Permalink
Adds support for explicit octal integer literal notation introduced i…
Browse files Browse the repository at this point in the history
…n PHP 8.1
  • Loading branch information
cfroystad committed Jun 19, 2021
1 parent ab11d08 commit 612bea7
Show file tree
Hide file tree
Showing 4 changed files with 1,607 additions and 1,595 deletions.
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ module.exports = grammar({

integer: $ => {
const decimal = /[1-9]\d*(_\d+)*/
const octal = /0[0-7]*(_[0-7]+)*/
const octal = /0[oO]?[0-7]*(_[0-7]+)*/
const hex = /0[xX][0-9a-fA-F]+(_[0-9a-fA-F]+)*/
const binary = /0[bB][01]+(_[01]+)*/
return token(choice(
Expand Down
4 changes: 2 additions & 2 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -2854,7 +2854,7 @@
},
{
"type": "PATTERN",
"value": "0[0-7]*(_[0-7]+)*"
"value": "0[oO]?[0-7]*(_[0-7]+)*"
},
{
"type": "PATTERN",
Expand Down Expand Up @@ -7615,7 +7615,7 @@
},
{
"type": "PATTERN",
"value": "[^*]*\\*+([^\\/*][^*]*\\*+)*"
"value": "[^*]*\\*+([^/*][^*]*\\*+)*"
},
{
"type": "STRING",
Expand Down
Loading

0 comments on commit 612bea7

Please sign in to comment.