mirror of
https://github.com/Kugelschieber/asl.git
synced 2026-01-18 12:00:25 +00:00
Updated README, strings can now contain comments.
This commit is contained in:
30
README.md
30
README.md
@@ -1,8 +1,34 @@
|
|||||||
# ASL
|
# ASL
|
||||||
|
|
||||||
ASL stands for Arma Scripting Language, which is a language compiled to SQF.
|
ASL stands for Arma Scripting Language, a C-style scripting language compiled to SQF.
|
||||||
This scripting language tries to simplify Arma mod development and eliminate the pain of bad syntax using SQF.
|
ASL is intended to simplify Arma 3 mod and mission development and eliminate the pain of SQF's bad syntax.
|
||||||
|
|
||||||
|
Main reasons for ASL:
|
||||||
|
|
||||||
|
* consistent and clean syntax
|
||||||
|
* less writing
|
||||||
|
* easier to read and maintain
|
||||||
|
* easy to lern and understand
|
||||||
|
* full replacement of SQF
|
||||||
|
* compatible with Arma wiki and commands
|
||||||
|
|
||||||
|
The compiler is written in Go and implemented as a simple recursive decent parser and uses concurrency to compile multiple files at once, which makes it really fast.
|
||||||
|
|
||||||
## Syntax
|
## Syntax
|
||||||
|
|
||||||
*coming soon*
|
*coming soon*
|
||||||
|
|
||||||
|
## Contribute
|
||||||
|
|
||||||
|
To contribute please create pull requests or explain your ideas in the issue section on GitHub. Report any bugs or incompatible ASL <-> SQF syntax you can find.
|
||||||
|
|
||||||
|
## Further information
|
||||||
|
|
||||||
|
For further information you can read the SQF tutorial and documentation of scripting commands on the Arma wiki.
|
||||||
|
|
||||||
|
* [Arma Wiki](https://community.bistudio.com/wiki/Main_Page)
|
||||||
|
* [Scripting commands](https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3)
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT
|
||||||
|
|||||||
@@ -1,3 +1,2 @@
|
|||||||
var _x = "This is a string!";
|
var _x = "/* multi line comment */";
|
||||||
var _y = "";
|
var _y = "// single line comment";
|
||||||
var _z = "\"mask\"";
|
|
||||||
|
|||||||
@@ -103,21 +103,34 @@ func Tokenize(code []byte) []Token {
|
|||||||
// multi line comments with /* ... */ (slash star, star slash).
|
// multi line comments with /* ... */ (slash star, star slash).
|
||||||
func removeComments(code []byte) []byte {
|
func removeComments(code []byte) []byte {
|
||||||
newcode := make([]byte, len(code))
|
newcode := make([]byte, len(code))
|
||||||
j := 0
|
j, mask, isstring := 0, false, false
|
||||||
|
|
||||||
for i := 0; i < len(code); i++ {
|
for i := 0; i < len(code); i++ {
|
||||||
c := code[i]
|
c := code[i]
|
||||||
|
|
||||||
if c == '/' && nextChar(code, i) == '/' {
|
// do not remove comments from strings
|
||||||
i = skipSingleLineComment(code, i+1)
|
if c == '\\' && !mask {
|
||||||
continue
|
mask = true
|
||||||
} else if c == '/' && nextChar(code, i) == '*' {
|
|
||||||
i = skipMultiLineComment(code, i+1)
|
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if c == '"' && !mask {
|
||||||
|
isstring = !isstring
|
||||||
|
}
|
||||||
|
|
||||||
|
// single/multi line comment
|
||||||
|
if !isstring {
|
||||||
|
if c == '/' && nextChar(code, i) == '/' {
|
||||||
|
i = skipSingleLineComment(code, i+1)
|
||||||
|
continue
|
||||||
|
} else if c == '/' && nextChar(code, i) == '*' {
|
||||||
|
i = skipMultiLineComment(code, i+1)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
newcode[j] = c
|
newcode[j] = c
|
||||||
j++
|
j++
|
||||||
|
mask = false
|
||||||
}
|
}
|
||||||
|
|
||||||
return newcode[:j]
|
return newcode[:j]
|
||||||
|
|||||||
Reference in New Issue
Block a user