Rename result_type to ptype, parser result to pvalue

This commit is contained in:
josh committed 2022-11-12 13:29:10 -05:00
1 parent bca0a14371
commit 8dc27686aa
5 files changed
+34 -34

No files matched your search

+3 -3
View File
@@ -168,15 +168,15 @@ class Propane
end
if parser
code = code.gsub(/\$\$/) do |match|
"_result"
"_pvalue"
end
code = code.gsub(/\$(\d+)/) do |match|
index = $1.to_i
"stateresults[$-1-n_states+#{index}].result"
"statevalues[$-1-n_states+#{index}].pvalue"
end
else
code = code.gsub(/\$\$/) do |match|
"lt.result"
"lt.pvalue"
end
code = code.gsub(/\$mode\(([a-zA-Z_][a-zA-Z_0-9]*)\)/) do |match|
mode_name = $1
+6 -6
View File
@@ -8,7 +8,7 @@ class Propane
attr_reader :rules
attr_reader :tokens
attr_reader :code_blocks
attr_reader :result_type
attr_reader :ptype
def initialize(input)
@patterns = []
@@ -19,7 +19,7 @@ class Propane
@next_line_number = @line_number
@mode = nil
@input = input.gsub("\r\n", "\n")
@result_type = "void *"
@ptype = "void *"
parse_grammar!
end
@@ -37,7 +37,7 @@ class Propane
elsif @mode.nil? && parse_mode_label!
elsif parse_module_statement!
elsif parse_class_statement!
elsif parse_result_type_statement!
elsif parse_ptype_statement!
elsif parse_pattern_statement!
elsif parse_token_statement!
elsif parse_tokenid_statement!
@@ -86,10 +86,10 @@ class Propane
end
end
def parse_result_type_statement!
if consume!(/result_type\s+/)
def parse_ptype_statement!
if consume!(/ptype\s+/)
md = consume!(/([^;]+);/, "expected result type expression")
@result_type = md[1].strip
@ptype = md[1].strip
end
end