Skip to content

Commit

Permalink
fix: Improve inplace/(post|pre) syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
phorward committed Oct 17, 2024
1 parent 530a8ad commit bfc5bb9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
16 changes: 8 additions & 8 deletions src/compiler/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1798,6 +1798,10 @@ impl Parser {
"emit" => "sequence",
"children" =>
(value!([
(value!([
"emit" => "identifier",
"value" => "_"
])),
(value!([
"emit" => "value_token_touch",
"value" => "["
Expand All @@ -1814,10 +1818,6 @@ impl Parser {
"emit" => "value_token_touch",
"value" => "]"
])),
(value!([
"emit" => "identifier",
"value" => "_"
])),
(value!([
"emit" => "call",
"children" =>
Expand Down Expand Up @@ -2118,10 +2118,6 @@ impl Parser {
"emit" => "identifier",
"value" => "Variable"
])),
(value!([
"emit" => "identifier",
"value" => "_"
])),
(value!([
"emit" => "op_mod_kle",
"children" =>
Expand Down Expand Up @@ -5058,6 +5054,10 @@ impl Parser {
]))
]))
])),
(value!([
"emit" => "identifier",
"value" => "_"
])),
(value!([
"emit" => "value_instance",
"children" =>
Expand Down
8 changes: 4 additions & 4 deletions src/compiler/tokay.tok
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# The Tokay programming language
# Copyright © 2023 by Jan Max Meyer, Phorward Software Technologies.
# Copyright © 2024 by Jan Max Meyer, Phorward Software Technologies.
# Licensed under the MIT license. See LICENSE for more information.
#
# This Tokay program expresses Tokay's grammar in itself.
Expand Down Expand Up @@ -127,7 +127,7 @@ Ccl : @{
# Statics, Variables, Loads

Subscript : @{
'[' _ Expression ']' _ ast("item")
_ '[' _ Expression ']' ast("item")
}

Attribute : @{
Expand All @@ -147,7 +147,7 @@ Variable : @{
}

Lvalue : @{
Variable _ Subscript* ast("lvalue") # Lvalue currently doesn't allow attribute assignment!
Variable Subscript* ast("lvalue") # Lvalue currently doesn't allow attribute assignment!
}

Load : @{
Expand Down Expand Up @@ -284,7 +284,7 @@ Atomic : @{
TokenModifier
Keyword<'if'> _ Expect<Expression> ___ Expect<Statement> \
(___ Keyword<'else'> _ ___ Expect<Statement>)? ast("op_if")
Keyword<'for'> _ Expect<Lvalue> Keyword<Expect<'in'>> _ Expect<Expression> \
Keyword<'for'> _ Expect<Lvalue> _ Keyword<Expect<'in'>> _ Expect<Expression> \
___ Expect<Statement> ast("op_for")
Keyword<'loop'> _ Expression ___ Block ast("op_loop")
Keyword<'loop'> _ Expect<Block> ast("op_loop")
Expand Down
2 changes: 1 addition & 1 deletion tests/list_add.tok
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ l
l = ,
i = 0
l += i
l, ++i
l ++i

# iadd with mutable object
l = ,
Expand Down

0 comments on commit bfc5bb9

Please sign in to comment.