Skip to content

Commit 119bb21

Browse files
committed
Add partial support for QuickBMSver statements
1 parent 1318425 commit 119bb21

File tree

5 files changed

+64
-1
lines changed

5 files changed

+64
-1
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ These are the currently supported language server endpoints.
2121
## QuickBMS commands
2222
The following QuickBMS commands are currently supported by the langauge server.
2323

24-
* [ ] `QuickBMSver VERSION`
24+
* [x] `QuickBMSver VERSION`
25+
* [ ] Support version numbers that are not specified as strings
2526
* [x] `FindLoc VAR TYPE STRING [FILENUM] [ERR_VALUE] [END_OFF]`
2627
* [x] `For [VAR] [OP] [VALUE] [COND] [VAR]`
2728
* [ ] Support all operators

src/server/keyword_docs.rs

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ pub fn get_keyword_docs() -> HashMap<String, String> {
5353
keyword!("while", "keyword_docs/do.txt"),
5454
keyword!("short", "keyword_docs/short.txt"),
5555
keyword!("open", "keyword_docs/open.txt"),
56+
keyword!("quickbmsver", "keyword_docs/quickbmsver.txt"),
5657
]
5758
.iter()
5859
.cloned()
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
QuickBMSver VERSION
2+
3+
Checks if the current version of QuickBMS is recent enough to
4+
support the script. Mainly for scripts created after the
5+
introduction of a new feature or an important fix.
6+
The instruction also enables some command-line options.
7+
8+
Arguments:
9+
VERSION Oldest version of QuickBMS for which the script was
10+
created the script, it's just the version displayed
11+
at runtime by the tool.
12+
It's possible to add some command-line options too:
13+
-64 force quickbms_4gb_files.exe
14+
-9 disable the safe memory allocator
15+
-I makes the variables case sensitive
16+
-. useful in reimport mode with data builders
17+
-N decimal names: 00000000.dat -> 0.dat
18+
-q quiet
19+
-T keep the temporary file if generated
20+
-d useful with some formats and scripts
21+
-D useful with some formats and scripts
22+
-e doesn't quit if compression fails
23+
-J all the strings are considered cstring
24+
-32 checks if the user is using quickbms.exe
25+
-F filter the input files
26+
-x hexadecimal notation in myitoa (debug)
27+
-j force UTF16 output in some functions
28+
-b C use C (char or hex) as filler in reimport
29+
if the new file is smaller
30+
-c this is NOT related to the -c option at
31+
command-line, it's a way to avoid being
32+
prompted when using C structures in the bms
33+
34+
Examples:
35+
QuickBMSver 0.2.4
36+
QuickBMSver "0.5.14 -9"
37+
QuickBMSver "-I -9"

tree-sitter-quickbms/grammar.js

+6
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ module.exports = grammar({
5252
$.getdstring_statement,
5353
$.do_statement,
5454
$.open_statement,
55+
$.quickbmsver_statement,
5556
),
5657
set_statement: $ => seq(
5758
$.set,
@@ -311,6 +312,10 @@ module.exports = grammar({
311312
),
312313
)),
313314
),
315+
quickbmsver_statement: $ => seq(
316+
$.quickbmsver,
317+
field("version", $._expression),
318+
),
314319
comparison: $ => choice(
315320
"<",
316321
">",
@@ -459,6 +464,7 @@ module.exports = grammar({
459464
do: $ => /[Dd][Oo]/,
460465
while: $ => /[Ww][Hh][Ii][Ll][Ee]/,
461466
open: $ => /[Oo][Pp][Ee][Nn]/,
467+
quickbmsver: $ => /[Qq][Uu][Ii][Cc][Kk][Bb][Mm][Ss][Vv][Ee][Rr]/,
462468
question_mark: $ => /\?/,
463469

464470
identifier: $ => /[a-zA-Z_\\\.\/]+[a-zA-Z0-9_\-\\\.\/]*/,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
================================================================================
2+
QuickBMSver statements
3+
================================================================================
4+
5+
# QuickBMSver 0.2.4
6+
QuickBMSver "0.5.14 -9"
7+
QuickBMSver "-I -9"
8+
9+
--------------------------------------------------------------------------------
10+
11+
(source_file
12+
(comment)
13+
(quickbmsver_statement
14+
(quickbmsver)
15+
(string_literal))
16+
(quickbmsver_statement
17+
(quickbmsver)
18+
(string_literal)))

0 commit comments

Comments
 (0)