Add lexer dump to main and fix a couple of bugs
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -17,7 +17,7 @@ Value: Value = {
|
||||
}
|
||||
|
||||
Label: String = {
|
||||
"[a-zA-Z]+" => String::from(<>),
|
||||
r"[a-zA-Z]+" => String::from(<>),
|
||||
}
|
||||
|
||||
Number: u64 = {
|
||||
@@ -69,11 +69,16 @@ Inst: Inst = {
|
||||
}
|
||||
|
||||
Directive: Directive = {
|
||||
".section" <s:Label> => Directive::Section(s.to_string()),
|
||||
r"\.section" <s:Label> => Directive::Section(s.to_string()),
|
||||
r"\.org" <v:Value> => Directive::Org(v),
|
||||
}
|
||||
|
||||
pub Line: Line = {
|
||||
Line: Line = {
|
||||
<Directive> => Line::Directive(<>),
|
||||
<Inst> => Line::Inst(<>),
|
||||
<LabelDef> => Line::LabelDef(<>),
|
||||
}
|
||||
|
||||
pub Program: Vec<Line> = {
|
||||
<Line*> => <>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user