-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #273 from ydah/fix-filepath-lineno
Fix file path and line number errors when using `+`, `*` and `()`
- Loading branch information
Showing
10 changed files
with
547 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class MyParser | ||
rule | ||
stmt: ('a') | ||
end | ||
---- header | ||
require 'strscan' | ||
---- inner | ||
def parse(str) | ||
@ss = StringScanner.new(str) | ||
do_parse | ||
end | ||
def next_token | ||
@ss.skip(/\\s+/) | ||
token = @ss.scan(/\\S+/) and [token, token] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class MyParser | ||
rule | ||
stmt: 'abc'* | ||
end | ||
---- header | ||
require 'strscan' | ||
---- inner | ||
def parse(str) | ||
@ss = StringScanner.new(str) | ||
do_parse | ||
end | ||
def next_token | ||
@ss.skip(/\\s+/) | ||
token = @ss.scan(/\\S+/) and [token, token] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class MyParser | ||
rule | ||
stmt: 'abc'+ | ||
end | ||
---- header | ||
require 'strscan' | ||
---- inner | ||
def parse(str) | ||
@ss = StringScanner.new(str) | ||
do_parse | ||
end | ||
def next_token | ||
@ss.skip(/\\s+/) | ||
token = @ss.scan(/\\S+/) and [token, token] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class MyParser | ||
rule | ||
stmt: 'abc'? | ||
end | ||
---- header | ||
require 'strscan' | ||
---- inner | ||
def parse(str) | ||
@ss = StringScanner.new(str) | ||
do_parse | ||
end | ||
def next_token | ||
@ss.skip(/\\s+/) | ||
token = @ss.scan(/\\S+/) and [token, token] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
# | ||
# DO NOT MODIFY!!!! | ||
# This file is automatically generated by Racc 1.8.0 | ||
# from Racc grammar file "group.y". | ||
# | ||
|
||
require 'racc/parser.rb' | ||
|
||
require 'strscan' | ||
class MyParser < Racc::Parser | ||
|
||
module_eval(<<'...end group.y/module_eval...', 'group.y', 8) | ||
def parse(str) | ||
@ss = StringScanner.new(str) | ||
do_parse | ||
end | ||
def next_token | ||
@ss.skip(/\\s+/) | ||
token = @ss.scan(/\\S+/) and [token, token] | ||
end | ||
...end group.y/module_eval... | ||
##### State transition tables begin ### | ||
|
||
racc_action_table = [ | ||
2, 4, 5 ] | ||
|
||
racc_action_check = [ | ||
0, 1, 4 ] | ||
|
||
racc_action_pointer = [ | ||
-2, 1, nil, nil, 2, nil ] | ||
|
||
racc_action_default = [ | ||
-3, -3, -1, -2, -3, 6 ] | ||
|
||
racc_goto_table = [ | ||
1, 3 ] | ||
|
||
racc_goto_check = [ | ||
1, 2 ] | ||
|
||
racc_goto_pointer = [ | ||
nil, 0, 1 ] | ||
|
||
racc_goto_default = [ | ||
nil, nil, nil ] | ||
|
||
racc_reduce_table = [ | ||
0, 0, :racc_error, | ||
1, 6, :_reduce_1, | ||
1, 5, :_reduce_none ] | ||
|
||
racc_reduce_n = 3 | ||
|
||
racc_shift_n = 6 | ||
|
||
racc_token_table = { | ||
false => 0, | ||
:error => 1, | ||
"a" => 2, | ||
"-temp-group" => 3 } | ||
|
||
racc_nt_base = 4 | ||
|
||
racc_use_result_var = true | ||
|
||
Racc_arg = [ | ||
racc_action_table, | ||
racc_action_check, | ||
racc_action_default, | ||
racc_action_pointer, | ||
racc_goto_table, | ||
racc_goto_check, | ||
racc_goto_default, | ||
racc_goto_pointer, | ||
racc_nt_base, | ||
racc_reduce_table, | ||
racc_token_table, | ||
racc_shift_n, | ||
racc_reduce_n, | ||
racc_use_result_var ] | ||
Ractor.make_shareable(Racc_arg) if defined?(Ractor) | ||
|
||
Racc_token_to_s_table = [ | ||
"$end", | ||
"error", | ||
"\"a\"", | ||
"\"-temp-group\"", | ||
"$start", | ||
"stmt", | ||
"\"-group@\\\"a\\\"\"" ] | ||
Ractor.make_shareable(Racc_token_to_s_table) if defined?(Ractor) | ||
|
||
Racc_debug_parser = false | ||
|
||
##### State transition tables end ##### | ||
|
||
# reduce 0 omitted | ||
|
||
module_eval(<<'.,.,', 'group.y', 4) | ||
def _reduce_1(val, _values, result) | ||
result = val | ||
result | ||
end | ||
.,., | ||
|
||
# reduce 2 omitted | ||
|
||
def _reduce_none(val, _values, result) | ||
val[0] | ||
end | ||
|
||
end # class MyParser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
# | ||
# DO NOT MODIFY!!!! | ||
# This file is automatically generated by Racc 1.8.0 | ||
# from Racc grammar file "many.y". | ||
# | ||
|
||
require 'racc/parser.rb' | ||
|
||
require 'strscan' | ||
class MyParser < Racc::Parser | ||
|
||
module_eval(<<'...end many.y/module_eval...', 'many.y', 8) | ||
def parse(str) | ||
@ss = StringScanner.new(str) | ||
do_parse | ||
end | ||
def next_token | ||
@ss.skip(/\\s+/) | ||
token = @ss.scan(/\\S+/) and [token, token] | ||
end | ||
...end many.y/module_eval... | ||
##### State transition tables begin ### | ||
|
||
racc_action_table = [ | ||
2, 4, 2, 6 ] | ||
|
||
racc_action_check = [ | ||
0, 1, 2, 4 ] | ||
|
||
racc_action_pointer = [ | ||
-2, 1, 0, nil, 3, nil, nil ] | ||
|
||
racc_action_default = [ | ||
-1, -4, -1, -3, -4, -2, 7 ] | ||
|
||
racc_goto_table = [ | ||
3, 1, 5 ] | ||
|
||
racc_goto_check = [ | ||
2, 1, 2 ] | ||
|
||
racc_goto_pointer = [ | ||
nil, 1, 0 ] | ||
|
||
racc_goto_default = [ | ||
nil, nil, nil ] | ||
|
||
racc_reduce_table = [ | ||
0, 0, :racc_error, | ||
0, 5, :_reduce_1, | ||
2, 5, :_reduce_2, | ||
1, 4, :_reduce_none ] | ||
|
||
racc_reduce_n = 4 | ||
|
||
racc_shift_n = 7 | ||
|
||
racc_token_table = { | ||
false => 0, | ||
:error => 1, | ||
"abc" => 2 } | ||
|
||
racc_nt_base = 3 | ||
|
||
racc_use_result_var = true | ||
|
||
Racc_arg = [ | ||
racc_action_table, | ||
racc_action_check, | ||
racc_action_default, | ||
racc_action_pointer, | ||
racc_goto_table, | ||
racc_goto_check, | ||
racc_goto_default, | ||
racc_goto_pointer, | ||
racc_nt_base, | ||
racc_reduce_table, | ||
racc_token_table, | ||
racc_shift_n, | ||
racc_reduce_n, | ||
racc_use_result_var ] | ||
Ractor.make_shareable(Racc_arg) if defined?(Ractor) | ||
|
||
Racc_token_to_s_table = [ | ||
"$end", | ||
"error", | ||
"\"abc\"", | ||
"$start", | ||
"stmt", | ||
"\"-many@abc\"" ] | ||
Ractor.make_shareable(Racc_token_to_s_table) if defined?(Ractor) | ||
|
||
Racc_debug_parser = false | ||
|
||
##### State transition tables end ##### | ||
|
||
# reduce 0 omitted | ||
|
||
module_eval(<<'.,.,', 'many.y', 4) | ||
def _reduce_1(val, _values, result) | ||
result = val[1] ? val[1].unshift(val[0]) : val | ||
result | ||
end | ||
.,., | ||
|
||
module_eval(<<'.,.,', 'many.y', 4) | ||
def _reduce_2(val, _values, result) | ||
result = val[1] ? val[1].unshift(val[0]) : val | ||
result | ||
end | ||
.,., | ||
|
||
# reduce 3 omitted | ||
|
||
def _reduce_none(val, _values, result) | ||
val[0] | ||
end | ||
|
||
end # class MyParser |
Oops, something went wrong.