-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enum values can be expressions including - unary operators - binary operators - string and number literals - parenthesis - identifiers See: https://github.com/microsoft/TypeScript/blob/master/doc/spec.md#92-enum-members https://github.com/microsoft/TypeScript/blob/master/doc/spec.md#419-binary-operators Note: this implementation performs a flat parse that neither handles expression-tree-building nor operator precedences. Note: This commit removes the minus from the NumericLit-token and parses it explicitly in TSDefParser.numberLiteral
- Loading branch information
Showing
4 changed files
with
65 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
declare module valueExpression { | ||
export enum Color { | ||
A = 3 + 3, | ||
B = "test" + "teste", | ||
C = 1 << 3, | ||
D = 10**2+1*8- - -3/3>>2<<3>>>+19%~~~3+ + +9 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
import scala.scalajs.js | ||
import js.annotation._ | ||
import js.| | ||
|
||
package valueExpression { | ||
|
||
package valueExpression { | ||
|
||
@js.native | ||
sealed trait Color extends js.Object { | ||
} | ||
|
||
@js.native | ||
@JSGlobal("valueExpression.Color") | ||
object Color extends js.Object { | ||
var A: Color = js.native | ||
var B: Color = js.native | ||
var C: Color = js.native | ||
var D: Color = js.native | ||
@JSBracketAccess | ||
def apply(value: Color): String = js.native | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters