Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix Odin attribute parsing to handle other operators within the attri…
…bute
  • Loading branch information
iansimonson committed Jul 21, 2023
commit 8e72bb0b37a29ef949d349cff49f84d08bac6edd
2 changes: 1 addition & 1 deletion 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
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