-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow string function parameters, add constant function
- Loading branch information
Showing
10 changed files
with
110 additions
and
23 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package m | ||
|
||
import ( | ||
"github.com/Vilsol/go-mlog/transpiler" | ||
"strings" | ||
) | ||
|
||
func init() { | ||
// TODO Optimize | ||
transpiler.RegisterFuncTranslation("m.Const", transpiler.Translator{ | ||
Count: func(args []transpiler.Resolvable, vars []transpiler.Resolvable) int { | ||
return 1 | ||
}, | ||
Variables: 1, | ||
Translate: func(args []transpiler.Resolvable, vars []transpiler.Resolvable) ([]transpiler.MLOGStatement, error) { | ||
return []transpiler.MLOGStatement{ | ||
&transpiler.MLOG{ | ||
Statement: [][]transpiler.Resolvable{ | ||
{ | ||
&transpiler.Value{Value: "set"}, | ||
vars[0], | ||
&transpiler.Value{Value: strings.Trim(args[0].GetValue(), "\"")}, | ||
}, | ||
}, | ||
}, | ||
}, nil | ||
}, | ||
}) | ||
} | ||
|
||
// Process provided string as a game constant | ||
// | ||
// Example m.Const("@copper") | ||
func Const(constant string) string { | ||
return "" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
package transpiler | ||
|
||
type Options struct { | ||
Numbers bool | ||
Comments bool | ||
NoStartup bool | ||
Stacked string | ||
Numbers bool | ||
Comments bool | ||
CommentOffset int | ||
NoStartup bool | ||
Stacked string | ||
Source bool | ||
} |
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
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
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