Skip to content

Commit

Permalink
Annotating rule with type
Browse files Browse the repository at this point in the history
  • Loading branch information
STRd6 committed Feb 20, 2024
1 parent 2d8edd6 commit 299cf1a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion source/parser.hera
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ import {
wrapIIFE,
} from "./parser/lib.civet"

import type {
UpdateExpression,
} from "./parser/types.civet"

/**
* A global object to hold methods used in rule handlers
* We can probably transition away from this now that Hera
Expand Down Expand Up @@ -455,7 +459,7 @@ NWTypePostfix
# https://262.ecma-international.org/#prod-UpdateExpression
UpdateExpression
# NOTE: Not allowing whitespace betwen prefix and postfix increment operators and operand
UpdateExpressionSymbol UnaryWithoutParenthesizedAssignment ->
UpdateExpressionSymbol UnaryWithoutParenthesizedAssignment :: UpdateExpression ->
return {
type: "UpdateExpression",
assigned: $2,
Expand Down
1 change: 0 additions & 1 deletion source/parser/pipe.civet
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ function constructPipeStep(fn, arg, returning) {
return [constructInvocation(fn, arg), null]
}


// head: expr
// body: [ws, pipe, ws, expr][]

Expand Down
5 changes: 5 additions & 0 deletions source/parser/types.civet
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ export type StatementTuple = [IndentNode, ASTNode, StatementDelimiter?]

export type Condition = ParenthesizedExpression

export type UpdateExpression
type: "UpdateExpression"
children: Children
assigned: ASTNode

export type ParenthesizedExpression
type: "ParenthesizedExpression"
children: Children
Expand Down

0 comments on commit 299cf1a

Please # to comment.