Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/cache@v4
with:
path: test/gamescripts
key: rpu-and-modderpack-gamescripts-v1004
key: rpu-and-modderpack-gamescripts-v1005

- name: Download RPU scripts & modderspack
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'skip-rpu-check')
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
uses: actions/cache@v4
with:
path: test/gamescripts
key: rpu-and-modderpack-gamescripts-v1004
key: rpu-and-modderpack-gamescripts-v1005
- name: Download RPU scripts & modderspack
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'skip-rpu-check')
shell: bash
Expand Down Expand Up @@ -234,7 +234,7 @@ jobs:
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'skip-rpu-check')
with:
path: test/gamescripts
key: rpu-and-modderpack-gamescripts-v1004
key: rpu-and-modderpack-gamescripts-v1005
fail-on-cache-miss: true
- name: Test on Fallout RPU
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'skip-rpu-check')
Expand Down Expand Up @@ -283,7 +283,7 @@ jobs:
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'skip-rpu-check')
with:
path: test/gamescripts
key: rpu-and-modderpack-gamescripts-v1004
key: rpu-and-modderpack-gamescripts-v1005
fail-on-cache-miss: true
- name: Test on Fallout RPU
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'skip-rpu-check')
Expand Down
5 changes: 5 additions & 0 deletions docs/sslc_readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ Syntax which requires sfall for compiled scripts to be interpreted is marked by
If you want to add additional condition for continuing the loop, use syntax: `foreach (<symbol> in <expression> while <expression>)`. In this case loop will iterate over elements of an array until last element or until "while" expression is true (whatever comes first).

__NOTE:__ Just like `for` loop, `continue` statement will respect increments of a hidden counter variable, so you can safely use it inside `foreach`.

- `#pragma sce` directive. If present anywhere in the compiled script, will enable short-circuit evaluation of logical `and` and `or` operators, even if `-s` command line argument is not used.

---

Expand All @@ -348,6 +350,9 @@ There are several changes in this version of sslc which may result in problems f

### Changelog

**sfall 4.4.10:**
- added #pragma sce

**sfall 4.4.7:**
- fixed leftover stack data caused by the `break` statement
- added Linux & WebAssembly builds
Expand Down
33 changes: 33 additions & 0 deletions lex.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ static void AppendToAssignCache() {
}

extern int backwardcompat;
extern int shortCircuit;

static int ungotToken = -1;
static int lastToken = -1;
Expand Down Expand Up @@ -637,6 +638,38 @@ int lex_internal(void) {
ungetChar();
}
}
else if (_stricmp(buf[which], "pragma") == 0) { // pragma directives
do {
c = getChar();
} while(c != EOF && c != '\n' && !validSymbolChar(c));

if (c == EOF) {
ungetChar();
}
else if (validSymbolChar(c)) {

buf[which][0] = c;

i = 0;
while(1) {
c = getChar();

if (!validSymbolChar(c) && c != '-')
break;

buf[which][i+1] = c;
i++;
}

buf[which][i+1] = 0;

if (_stricmp(buf[which], "sce") == 0 && !shortCircuit) {
shortCircuit = 1;
}
if (c == EOF)
ungetChar();
}
}
else if (c == EOF) {
ungetChar();
}
Expand Down
2 changes: 1 addition & 1 deletion parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extern int warnings;
extern int optimize;
extern int debug;
extern int dumpTree;
extern int shortCircuit;

void optimizeTree(Program *program);

/*
Expand Down