Skip to content

Commit

Permalink
Implemented Self usage from todo in tokay.tok
Browse files Browse the repository at this point in the history
This fixes tokay-lang#31 as well already.
  • Loading branch information
phorward committed Jun 7, 2023
1 parent 68fc8b6 commit d966e2a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
18 changes: 9 additions & 9 deletions src/compiler/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3924,7 +3924,7 @@ impl Parser {
(value!([
(value!([
"emit" => "identifier",
"value" => "Token1"
"value" => "Token"
])),
(value!([
"emit" => "value_parselet",
Expand Down Expand Up @@ -4049,8 +4049,8 @@ impl Parser {
"emit" => "op_mod_expect",
"children" =>
(value!([
"emit" => "identifier",
"value" => "Token1"
"emit" => "value_token_self",
"value" => "Self"
]))
])),
(value!([
Expand Down Expand Up @@ -4089,8 +4089,8 @@ impl Parser {
"emit" => "op_mod_expect",
"children" =>
(value!([
"emit" => "identifier",
"value" => "Token1"
"emit" => "value_token_self",
"value" => "Self"
]))
])),
(value!([
Expand Down Expand Up @@ -4129,8 +4129,8 @@ impl Parser {
"emit" => "op_mod_expect",
"children" =>
(value!([
"emit" => "identifier",
"value" => "Token1"
"emit" => "value_token_self",
"value" => "Self"
]))
])),
(value!([
Expand Down Expand Up @@ -4425,7 +4425,7 @@ impl Parser {
])),
(value!([
"emit" => "identifier",
"value" => "Token1"
"value" => "Token"
])),
(value!([
"emit" => "sequence",
Expand Down Expand Up @@ -7379,7 +7379,7 @@ impl Parser {
(value!([
(value!([
"emit" => "identifier",
"value" => "Token1"
"value" => "Token"
])),
(value!([
"emit" => "identifier",
Expand Down
12 changes: 6 additions & 6 deletions src/compiler/tokay.tok
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,14 @@ TokenAtom : @{
ParseletInstance
}

Token1 : @{ # todo: Token1 can be renamed back to Token again when #31 is fixed and Self is used.
Token : @{
TokenAtom '+' ast("op_mod_pos")
TokenAtom '*' ast("op_mod_kle")
TokenAtom '?' ast("op_mod_opt")
TokenAtom
'peek' _standalone_ expect Token1 ast("op_mod_peek")
'not' _standalone_ expect Token1 ast("op_mod_not")
'expect' _standalone_ expect Token1 ast("op_mod_expect")
'peek' _standalone_ expect Self ast("op_mod_peek")
'not' _standalone_ expect Self ast("op_mod_not")
'expect' _standalone_ expect Self ast("op_mod_expect")
}

# Expression & Flow
Expand All @@ -280,7 +280,7 @@ Literal : @{
Atomic : @{
'(' _ ___ HoldExpression ___ ')'
Literal
Token1
Token
'if' _standalone_ expect HoldExpression ___ expect Statement (___ 'else' _standalone_ ___ expect Statement)? ast("op_if")
'for' _standalone_ expect Lvalue _ expect 'in' _standalone_ expect Expression ___ expect Statement ast("op_for")
'loop' _standalone_ HoldExpression ___ Block ast("op_loop")
Expand Down Expand Up @@ -402,7 +402,7 @@ Instruction : @{
'end' _standalone_ Sequences expect T_EOL ast("end")
T_Identifier _ ':' _ {
Literal _ peek T_EOL
Token1 _ peek T_EOL
Token _ peek T_EOL
Sequences
} expect T_EOL ast("constant")
Statement T_EOL
Expand Down
2 changes: 1 addition & 1 deletion src/prelude.tok
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Repeat : @<P> min=1, max=void {

List : @<P, Separator: (',' _), empty: true> {
Self Separator P $1 + $3
if empty Self Separator # allows for trailing Separator
if empty (Self Separator) # allows for trailing Separator
P ($1, )
}

Expand Down

0 comments on commit d966e2a

Please sign in to comment.