This commit is contained in:
josh committed 2023-07-12 22:24:40 -04:00
1 parent 7d7929a358
commit ae9f2e4efa
4 files changed
+64 -47

No files matched your search

+10
View File
@@ -12,6 +12,7 @@ class Propane
attr_reader :tokens
attr_reader :code_blocks
attr_reader :ptypes
attr_reader :prefix
def initialize(input)
@patterns = []
@@ -23,6 +24,7 @@ class Propane
@mode = nil
@input = input.gsub("\r\n", "\n")
@ptypes = {"default" => "void *"}
@prefix = "p_"
parse_grammar!
end
@@ -55,6 +57,7 @@ class Propane
elsif parse_drop_statement!
elsif parse_rule_statement!
elsif parse_code_block_statement!
elsif parse_prefix_statement!
else
if @input.size > 25
@input = @input.slice(0..20) + "..."
@@ -195,6 +198,13 @@ class Propane
end
end
def parse_prefix_statement!
if md = consume!(/prefix\s+(#{IDENTIFIER_REGEX})\s*;/)
@prefix = md[1]
true
end
end
def parse_pattern!
if md = consume!(%r{/})
pattern = ""