Last active
September 25, 2021 21:00
-
-
Save duchainer/dd4f04fb6a320cbeaf3fddf926bd28f3 to your computer and use it in GitHub Desktop.
WIP Godot scene parser in Smalltalk Compiler-Compiler (SmaCC) in glamorous toolkit
This file contains hidden or 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
Start | |
: Section+ | |
; | |
Section | |
: Header ContentParam* | |
; | |
Header | |
: <leftBracket> <name> HeaderParam* <rightBracket> | |
; | |
<leftBracket> : \[ ; | |
<rightBracket>: \] ; | |
# no prefix number | |
# \w is letter, number or underscore | |
<name> | |
: ( [a-zA-Z] | _ ) \w* | |
; | |
<whitespace>: \s+ ; | |
# Key=Value | |
HeaderParam | |
: Key <equal> Value | |
; | |
Key : <name> ; | |
<equal> : \= ; | |
Value | |
: <name> | |
| <number> | |
| <string> | |
| FunctionCall | |
; | |
#All number literals | |
<number> : <integer> | <floatnumber>; | |
# Integer literals | |
<decimalinteger> : [1-9] [0-9]* | 0 ; | |
<integer> : <decimalinteger>; | |
#Float literals | |
<pointfloat> : ([0-9]+ \. [0-9]*) | (\. [0-9]+) ; | |
<exponentfloat> : ([0-9]+ | <pointfloat>) (e | E) (\+|\-)? [0-9]+ ; | |
<floatnumber> : <pointfloat> | <exponentfloat> ; | |
<string> | |
: \" [^\"]* \" | |
; | |
FunctionCall | |
: <name> <leftBrace> Value? <rightBrace> | |
; | |
<leftBrace> | |
: \( | |
; | |
<rightBrace> | |
: \) | |
; | |
ContentParam | |
: Key <equal> Value | |
; |
This file contains hidden or 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
[gd_scene load_steps=2 format=2] | |
[ext_resource path="res://icon.png" type="texture" id=1] | |
[node name="Node2D" type="Node2D"] | |
[node name="Sprite" type="Sprite" parent="."] | |
texture = ExtResource( 1 ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just managed to fix the FunctionCall scanning by removing all references to , so now these are correctly implied by SmaCC. 🥳