mirror of
https://github.com/Kugelschieber/asl.git
synced 2026-01-18 12:00:25 +00:00
That's it basically, need own context to compile sub parts within other
compilation.
This commit is contained in:
@@ -205,6 +205,7 @@ Keywords should not be used as identifiers. Here is a full list of all keywords
|
|||||||
| catch |
|
| catch |
|
||||||
| exitwith |
|
| exitwith |
|
||||||
| waituntil |
|
| waituntil |
|
||||||
|
| code |
|
||||||
|
|
||||||
## What's missing?
|
## What's missing?
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
var inline_code = code("var x = 5;");
|
var inline_code = code("");
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import (
|
|||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const TAB = " "
|
|
||||||
|
|
||||||
// Parses tokens, validates code to a specific degree
|
// Parses tokens, validates code to a specific degree
|
||||||
// and writes SQF code into desired location.
|
// and writes SQF code into desired location.
|
||||||
func Parse(token []Token, prettyPrinting bool) string {
|
func Parse(token []Token, prettyPrinting bool) string {
|
||||||
@@ -290,6 +288,23 @@ func parseWaitUntil() {
|
|||||||
appendOut("};", true)
|
appendOut("};", true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func parseInlineCode() string {
|
||||||
|
expect("code")
|
||||||
|
expect("(")
|
||||||
|
|
||||||
|
code := get().token
|
||||||
|
next()
|
||||||
|
output := "{}"
|
||||||
|
|
||||||
|
if len(code) > 2 {
|
||||||
|
output = "{"+Parse(Tokenize([]byte(code[1:len(code)-1])), pretty)+"}"
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(")")
|
||||||
|
|
||||||
|
return output
|
||||||
|
}
|
||||||
|
|
||||||
// Everything that does not start with a keyword.
|
// Everything that does not start with a keyword.
|
||||||
func parseStatement() {
|
func parseStatement() {
|
||||||
// empty block
|
// empty block
|
||||||
@@ -426,7 +441,9 @@ func parseExpression(out bool) string {
|
|||||||
func parseIdentifier() string {
|
func parseIdentifier() string {
|
||||||
output := ""
|
output := ""
|
||||||
|
|
||||||
if seek("(") && !accept("!") && !accept("-") {
|
if accept("code") {
|
||||||
|
output += parseInlineCode()
|
||||||
|
} else if seek("(") && !accept("!") && !accept("-") {
|
||||||
name := get().token
|
name := get().token
|
||||||
next()
|
next()
|
||||||
output = "(" + parseFunctionCall(false, name) + ")"
|
output = "(" + parseFunctionCall(false, name) + ")"
|
||||||
|
|||||||
Reference in New Issue
Block a user