Commit graph

25 commits

Author SHA1 Message Date
Fernando Rozenblit
ab96d4ce60
Add more details to "Return without GOSUB" error. Also fix printing of INS_CALL_METHOD_ID in the .lst (#395)
For INS_CALL_METHOD_ID, the number of parameters 'type' is u8 and was being printed as char.
2021-08-31 08:06:20 +02:00
Kevin Eady
e41f70d72e
Add support for interpolated strings ("interstrings") (#369)
* Update grammar to support interpolated strings

* Struct initializers, case switchs are regular strings

* Initial stub for interpolated string in AST
This splits the previous STRING_LITERAL terminal into a production,
stringLiteral, to handle REGULAR_STRING terminal and interpolatedString
production.

* Change interpolated strings to expressions

* Fix mode handling in grammar

* Grammar fixes
- Fix mode handling in lexer
- Interpolated strings only have one expression

* Can successfully parse, stub compile interstrings
$"He {there + print("hello")}";

* Add formatting string to grammar

* Fix tests, and add test stubs

* Rename curleys to brace; better AST generation

* initial work interstring instruction

* Initial work on formatted string instruction: emit

* Formatted string instruction: execution

* Add simple formatted string test

* Add formatted string test src

* Review changes #1
- Rename `FormattedString` to `FormatExpression`
- Rename overloaded `try_to_format()` to `get_formatted()`

* Review changes part 2
- Rename `InterpolatedString` ast node to `InterpolateString`

* Review changes part 3
- Modify `ins_interpolate_string`

* Review changes part 4
- Remove unused formal parameter

* Add negative tests

* Spruce up positive tests

* Fix braces, escape chars inside interstring

* Fix, add tests for escaped char and double brace

* Address differences for new lines in tests

* Update Escript version

* Make empty expression an error

* Add documentation for interpolated strings

* Quick touchup on docs
2021-03-11 22:48:16 +01:00
Eric Swanson
1c3a96d2d6 Remove 'declare' keyword 2020-05-07 00:18:10 -07:00
Eric Swanson
36d8603666 Add elvis operator:
a ?: b

Evaluates to a if a is true (not: false, 0, undefined, etc)
Otherwise evaluates to b

Short-circuit evaluation
2020-04-29 02:50:11 -07:00
turleypol
fc523320d9 added support of ++/-- for object members. 2019-09-26 07:06:45 +02:00
turleypol
169c1ec4e3 added i--, corrected that no warning appears when using i++. Extended
tests
2019-09-22 11:04:57 +02:00
turleypol
b2a3e1b792 starting to support i++ 2019-09-22 00:34:14 +02:00
turleypol
902c9cbfde first version of ++i and --i unary operator 2019-09-21 14:56:06 +02:00
turleypol
4f40aa7997 removed Clib::decint and used Clib::tostring, changed Clib::hexint to
template function for all integers
2018-10-28 09:31:58 +01:00
turleypol
a5e6206164 Added cmake option to run clang-tidy
used everywhere nullptr
2018-10-09 16:36:35 +02:00
turleypol
0d04d5e19b Current FunctionRef status. Mixed with a few more cmake stuff 2018-02-03 19:05:22 +01:00
turleypol
dbb25bdb62
Include and buildsystem cleanup (#45)
Include cleanup
Reworked buildsystem (Linux only)
Removed dynamic libs, Linux now again uses static linking (like windows)
2018-01-29 21:55:48 +01:00
turley
189cad3479 Formating everything
Authors are not forced to use the clang-format setting, but should
atleast be inspired by the style.
The only thing which is now not allowed are tabs for ident/alignment!
2016-02-19 19:26:35 +01:00
turley
ed7b16b233 normalized lineendings 2016-02-11 22:54:43 +01:00
Gabriele Tozzi
d1ac902926 Documentation: reformatted headers for DoxyGen 2016-01-28 14:52:40 +01:00
Gabriele Tozzi
15a2ccfd32 Added: new bscript keyword "unused"
Has no practical effect, but tells the compiler not to issue a warning
if the following variable in a function or program definition is will
not be used. The compiler will instead issue a warning if the given
variable is used.

Example:
program onremovescript( character, container, unused item, unused item_amount, movetype )
  <some code here...>
endprogram

function myfunc( parameter1, unused parameter_for_future_use )
  <some code here...>
endfunction
2015-08-27 22:46:48 +02:00
frozenblit
1f0f7581dd Some more cleanups 2014-11-03 01:29:21 +01:00
turley
31ee263a45 activated new logging facility 2014-01-18 13:29:38 +00:00
turley
99d7dc3037 namespaces...finally :)
Hard part is finished every file is touched. Namespaces are currently rough named by directory name.
Maybe we could split it more
2013-12-21 09:10:46 +00:00
turley
fac3213f2a finally support for +=,-=,*=,/=,%= with objectmembers, like who.resist_fire_mod+=1 2012-01-03 14:53:36 +00:00
KevinEady
992059a42a fixed breaks from do and repeat clauses not jumping to proper location; added space between "goto" and PC in listfiles 2011-12-12 05:54:20 +00:00
AustinHeilman
f55162e603 Applied KnightRage's patches for errors found by Andenixa 2011-10-22 07:26:34 +00:00
turley
e10cd27cea sync: shini - long to int (prerequisit for 64-bit) 2010-03-29 14:52:03 +00:00
muaddib_pol
4f01460d16 + bscript project upgrade to use literal paths. Removed include of ".."
+ Couple format/cleanup
2009-09-11 12:15:05 +00:00
muaddib_pol
d032ee448f + POL is now, open source. 2009-09-03 19:44:42 +00:00