mirror of
https://github.com/Kugelschieber/asl.git
synced 2026-01-18 12:00:25 +00:00
Compare commits
3 Commits
bugfix-asy
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5fe69dc3d4 | ||
|
|
611307d68a | ||
|
|
98a4873427 |
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
**1.2.2**
|
||||
|
||||
* bugfix: deadlock on compiling multile files at once
|
||||
|
||||
**1.2.1**
|
||||
|
||||
* bugfix: new line after while for pretty printing
|
||||
|
||||
22
README.md
22
README.md
@@ -80,7 +80,7 @@ var array = [1, 2, 3];
|
||||
var one = array[0];
|
||||
|
||||
// accessing using a statement:
|
||||
var zwo = array[33/3-2];
|
||||
var two = array[33/3-2];
|
||||
|
||||
// it is possble to use arrays in expressions:
|
||||
var emptyArray = one-[1];
|
||||
@@ -153,7 +153,7 @@ func add(_a = 0, _b = 0) {
|
||||
var _x = add(); // result in _x is 0
|
||||
```
|
||||
|
||||
When trying to define a function with a name that exists in SQF's build in function set, you'll get an compile error. So declaring "func hint()..." won't compile.
|
||||
When trying to define a function with a name that exists in SQF's build in function set, you'll get an compile error. So declaring `func hint()...` won't compile.
|
||||
|
||||
### Call build in commands
|
||||
|
||||
@@ -271,15 +271,19 @@ Keywords must not be used as identifiers. Here is a full list of all keywords in
|
||||
|
||||
## What's missing?
|
||||
|
||||
The following features are not implemented yet, but maybe will be in 1.3.0 or a future version:
|
||||
The following features are not implemented yet, but might be in a future version:
|
||||
|
||||
* scopes
|
||||
* else if
|
||||
* selector in expression
|
||||
**scopes**
|
||||
|
||||
scopes won't be supported, since it's a stupid concept and can be replaced by functions.
|
||||
Scopes won't be supported, since it's a stupid concept and can be replaced by functions.
|
||||
|
||||
Selectors in expressions do not work (yet), so this is not possible:
|
||||
**else if**
|
||||
|
||||
Planned.
|
||||
|
||||
**Selector in expression**
|
||||
|
||||
Selectors in expressions do not work yet, so this is not possible:
|
||||
|
||||
```
|
||||
var x = ([1, 2, 3]-[1, 2])[0]; // should result in 3
|
||||
@@ -287,7 +291,7 @@ var x = ([1, 2, 3]-[1, 2])[0]; // should result in 3
|
||||
|
||||
## 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.
|
||||
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 with a short example.
|
||||
|
||||
## Further information
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
version = "1.2.1"
|
||||
version = "1.2.2"
|
||||
extension = ".asl"
|
||||
sqfextension = ".sqf"
|
||||
typeinfo = "types"
|
||||
@@ -104,17 +104,15 @@ func readAslFiles(path string) {
|
||||
}
|
||||
|
||||
// Recovers and prints thrown error.
|
||||
func recoverCompileError(file string, waiter chan bool) {
|
||||
func recoverCompileError(file string) {
|
||||
if r := recover(); r != nil {
|
||||
fmt.Println("Compile error in file "+file+":", r)
|
||||
}
|
||||
|
||||
waiter <- true // the show must go on
|
||||
}
|
||||
|
||||
// Compiles a single ASL file.
|
||||
func compileFile(path string, file ASLFile, waiter chan bool) {
|
||||
defer recoverCompileError(file.in, waiter)
|
||||
func compileFile(path string, file ASLFile) {
|
||||
defer recoverCompileError(file.in)
|
||||
|
||||
// read file
|
||||
out := filepath.FromSlash(path + PathSeparator + file.out + PathSeparator + file.newname + sqfextension)
|
||||
@@ -138,22 +136,12 @@ func compileFile(path string, file ASLFile, waiter chan bool) {
|
||||
fmt.Println("Error writing file: " + file.out)
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
waiter <- true // done
|
||||
}
|
||||
|
||||
// Compiles ASL files concurrently.
|
||||
// Compiles ASL files.
|
||||
func compile(path string) {
|
||||
waiter := make(chan bool, len(aslFiles))
|
||||
|
||||
// fire compile
|
||||
for i := 0; i < len(aslFiles); i++ {
|
||||
go compileFile(path, aslFiles[i], waiter)
|
||||
}
|
||||
|
||||
// wait until all files are compiled
|
||||
for i := 0; i < len(aslFiles); i++ {
|
||||
<-waiter
|
||||
compileFile(path, aslFiles[i])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user