Skip to content

Commit

Permalink
fix: escape brace in regex
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed Mar 10, 2024
1 parent 365fd18 commit 2128072
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ license = "MIT"

build = "bindings/rust/build.rs"
include = [
"common",
"bindings/rust",
"php/grammar.js",
"php/src",
"php_only/grammar.js",
"php_only/src",
"queries",
"common",
"bindings/rust",
"php/grammar.js",
"php/src",
"php_only/grammar.js",
"php_only/src",
"queries",
]

[lib]
Expand Down
2 changes: 1 addition & 1 deletion bindings/rust/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn main() {
php_only_dir.join("parser.c"),
php_only_dir.join("scanner.c"),
] {
c_config.file(&path);
c_config.file(path);
println!("cargo:rerun-if-changed={}", path.to_str().unwrap());
}

Expand Down
2 changes: 1 addition & 1 deletion common/define-grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,7 @@ module.exports = function defineGrammar(dialect) {
'`',
/[0-7]{1,3}/,
/x[0-9A-Fa-f]{1,2}/,
/u{[0-9A-Fa-f]+}/,
/u\{[0-9A-Fa-f]+\}/,
),
)),

Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
},
"homepage": "https://github.com/tree-sitter/tree-sitter-php#readme",
"dependencies": {
"nan": "^2.18.0"
"nan": "^2.19.0",
"tree-sitter": "^0.20.6"
},
"devDependencies": {
"eslint": ">=8.54.0",
"eslint": ">=8.57.0",
"eslint-config-google": "^0.14.0",
"node-gyp": "^10.0.1",
"shelljs": "^0.8.5",
Expand All @@ -42,7 +43,9 @@
"tree-sitter": [
{
"scope": "source.php",
"file-types": ["php"],
"file-types": [
"php"
],
"path": "php",
"highlights": "queries/highlights.scm",
"injections": [
Expand Down
9 changes: 7 additions & 2 deletions php/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
"tree-sitter": [
{
"scope": "source.php",
"file-types": ["php"],
"file-types": [
"php"
],
"highlights": "../queries/highlights.scm",
"injections": [
"../queries/injections.scm",
"../queries/injections-text.scm"
],
"tags": "../queries/tags.scm"
"tags": "../queries/tags.scm",
"external-files": [
"../common/scanner.h"
]
}
]
}
2 changes: 1 addition & 1 deletion php/src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -7081,7 +7081,7 @@
},
{
"type": "PATTERN",
"value": "u{[0-9A-Fa-f]+}"
"value": "u\\{[0-9A-Fa-f]+\\}"
}
]
}
Expand Down
7 changes: 4 additions & 3 deletions php/src/parser.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "tree_sitter/parser.h"

#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif

Expand Down Expand Up @@ -144079,10 +144078,12 @@ unsigned tree_sitter_php_external_scanner_serialize(void *, char *);
void tree_sitter_php_external_scanner_deserialize(void *, const char *, unsigned);

#ifdef _WIN32
#define extern __declspec(dllexport)
#define TS_PUBLIC __declspec(dllexport)
#else
#define TS_PUBLIC __attribute__((visibility("default")))
#endif

extern const TSLanguage *tree_sitter_php(void) {
TS_PUBLIC const TSLanguage *tree_sitter_php() {
static const TSLanguage language = {
.version = LANGUAGE_VERSION,
.symbol_count = SYMBOL_COUNT,
Expand Down
9 changes: 7 additions & 2 deletions php_only/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
"tree-sitter": [
{
"scope": "source.php",
"file-types": ["php"],
"file-types": [
"php"
],
"highlights": "../queries/highlights.scm",
"injections": "../queries/injections.scm",
"tags": "../queries/tags.scm"
"tags": "../queries/tags.scm",
"external-files": [
"../common/scanner.h"
]
}
]
}
2 changes: 1 addition & 1 deletion php_only/src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -7076,7 +7076,7 @@
},
{
"type": "PATTERN",
"value": "u{[0-9A-Fa-f]+}"
"value": "u\\{[0-9A-Fa-f]+\\}"
}
]
}
Expand Down
7 changes: 4 additions & 3 deletions php_only/src/parser.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "tree_sitter/parser.h"

#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif

Expand Down Expand Up @@ -133228,10 +133227,12 @@ unsigned tree_sitter_php_only_external_scanner_serialize(void *, char *);
void tree_sitter_php_only_external_scanner_deserialize(void *, const char *, unsigned);

#ifdef _WIN32
#define extern __declspec(dllexport)
#define TS_PUBLIC __declspec(dllexport)
#else
#define TS_PUBLIC __attribute__((visibility("default")))
#endif

extern const TSLanguage *tree_sitter_php_only(void) {
TS_PUBLIC const TSLanguage *tree_sitter_php_only() {
static const TSLanguage language = {
.version = LANGUAGE_VERSION,
.symbol_count = SYMBOL_COUNT,
Expand Down

0 comments on commit 2128072

Please sign in to comment.