mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-10 05:22:23 +00:00
comments
This commit is contained in:
parent
f80869db1f
commit
b3dfa5e28f
@ -61,7 +61,8 @@ module Tartrazine
|
|||||||
# <rule>
|
# <rule>
|
||||||
# <pop depth="1"/>
|
# <pop depth="1"/>
|
||||||
# </rule>
|
# </rule>
|
||||||
# They match, don't move pos, and alter the stack
|
# They match, don't move pos, probably alter
|
||||||
|
# the stack, probably not generate tokens
|
||||||
class Always < Rule
|
class Always < Rule
|
||||||
def match(text, pos, lexer) : Tuple(Bool, Int32, Array(Token))
|
def match(text, pos, lexer) : Tuple(Bool, Int32, Array(Token))
|
||||||
tokens = [] of Token
|
tokens = [] of Token
|
||||||
@ -84,7 +85,7 @@ module Tartrazine
|
|||||||
when "token"
|
when "token"
|
||||||
raise Exception.new "Can't have a token without a match" if match.nil?
|
raise Exception.new "Can't have a token without a match" if match.nil?
|
||||||
[Token.new(type: xml["type"], value: match[0])]
|
[Token.new(type: xml["type"], value: match[0])]
|
||||||
# TODO handle #push #push:n #pop and multiple states
|
# TODO handle #push #push:n #pop and multiple states
|
||||||
when "push"
|
when "push"
|
||||||
puts "Pushing state #{xml["state"]}"
|
puts "Pushing state #{xml["state"]}"
|
||||||
lexer.state_stack << xml["state"]
|
lexer.state_stack << xml["state"]
|
||||||
|
Loading…
Reference in New Issue
Block a user