Skip to content

Commit

Permalink
Fix attributes and <, > in Odin Lexer (#803)
Browse files Browse the repository at this point in the history
  • Loading branch information
iansimonson committed Jul 21, 2023
1 parent e1e698d commit b8c853d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lexers/embedded/odin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<rule pattern = "\#[a-zA-Z_]+\b">
<token type = "NameDecorator"/>
</rule>
<rule pattern = "\@\(?[a-zA-Z_]+\b\s*(=\s*&quot;?[0-9a-zA-Z_.]+&quot;?)?\)?">
<rule pattern = "\@(\([a-zA-Z_]+\b\s*.*\)|\(?[a-zA-Z_]+\)?)">
<token type = "NameAttribute"/>
</rule>
<rule pattern="[a-zA-Z_]\w*">
Expand Down Expand Up @@ -102,7 +102,7 @@
<rule pattern = "&quot;(\\\\|\\&quot;|[^&quot;])*&quot;" >
<token type = "LiteralString"/>
</rule>
<rule pattern = "(&lt;&lt;=|&gt;&gt;=|&lt;&lt;|&gt;&gt;|&lt;=|&gt;=|&amp;=|&amp;|\+=|-=|\*=|/=|%=|\||\^|=|&amp;&amp;|\|\||--|-&gt;|=|==|!=|:=|:|::|\.\.\&lt;|\.\.=|[+\-*/%&amp;])" >
<rule pattern = "(&lt;&lt;=|&gt;&gt;=|&lt;&lt;|&gt;&gt;|&lt;=|&gt;=|&amp;=|&amp;|\+=|-=|\*=|/=|%=|\||\^|=|&amp;&amp;|\|\||--|-&gt;|=|==|!=|:=|:|::|\.\.\&lt;|\.\.=|[&lt;&gt;+\-*/%&amp;])" >
<token type = "Operator"/>
</rule>
<rule pattern="[{}()\[\],.;]">
Expand Down
2 changes: 1 addition & 1 deletion lexers/testdata/odin.actual
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ a_test_proc :: proc(t: ^testing.T) {
testing.errnof("a format: %s", value)
}

@(disable = ODIN_DEBUG)
@(disable = LOG_LEVEL >= .Debug)
debug_thing :: proc(x, y, z: int) {
fmt.println(x, y, z)
}
Expand Down
5 changes: 3 additions & 2 deletions lexers/testdata/odin.expected
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@
{"type":"TextWhitespace","value":"\n"},
{"type":"Punctuation","value":"}"},
{"type":"TextWhitespace","value":"\n\n"},
{"type":"NameAttribute","value":"@(disable = ODIN_DEBUG)"},
{"type":"NameAttribute","value":"@(disable = LOG_LEVEL \u003e= .Debug)"},
{"type":"TextWhitespace","value":"\n"},
{"type":"Name","value":"debug_thing"},
{"type":"TextWhitespace","value":" "},
Expand Down Expand Up @@ -427,7 +427,8 @@
{"type":"TextWhitespace","value":"\n"},
{"type":"Punctuation","value":"}"},
{"type":"TextWhitespace","value":"\n\n"},
{"type":"NameAttribute","value":"@private\n"},
{"type":"NameAttribute","value":"@private"},
{"type":"TextWhitespace","value":"\n"},
{"type":"Name","value":"program"},
{"type":"TextWhitespace","value":" "},
{"type":"Operator","value":":="},
Expand Down

0 comments on commit b8c853d

Please sign in to comment.