Skip to content

Commit

Permalink
feat: Create external scanner stub.
Browse files Browse the repository at this point in the history
  • Loading branch information
reiniscirpons committed May 26, 2024
1 parent 02c8767 commit a535485
Show file tree
Hide file tree
Showing 7 changed files with 2,831 additions and 2,424 deletions.
1 change: 1 addition & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
],
"sources": [
"src/parser.c",
"src/scanner.c",
"bindings/node/binding.cc"
],
"cflags_c": [
Expand Down
5 changes: 0 additions & 5 deletions bindings/rust/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,9 @@ fn main() {
let parser_path = src_dir.join("parser.c");
c_config.file(&parser_path);

// If your language uses an external scanner written in C,
// then include this block of code:

/*
let scanner_path = src_dir.join("scanner.c");
c_config.file(&scanner_path);
println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
*/

c_config.compile("parser");
println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap());
Expand Down
5 changes: 5 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ const PREC = {
module.exports = grammar({
name: 'GAP',

externals: $ => [
$.line_continuation
],

extras: $ => [
$.comment,
/\s/,
$.line_continuation,
],

inline: $ => [
Expand Down
11 changes: 10 additions & 1 deletion src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -2258,6 +2258,10 @@
{
"type": "PATTERN",
"value": "\\s"
},
{
"type": "SYMBOL",
"name": "line_continuation"
}
],
"conflicts": [
Expand All @@ -2271,7 +2275,12 @@
]
],
"precedences": [],
"externals": [],
"externals": [
{
"type": "SYMBOL",
"name": "line_continuation"
}
],
"inline": [
"_expression",
"_statement"
Expand Down
4 changes: 4 additions & 0 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -4208,6 +4208,10 @@
"type": "integer",
"named": true
},
{
"type": "line_continuation",
"named": true
},
{
"type": "local",
"named": false
Expand Down
Loading

0 comments on commit a535485

Please sign in to comment.