Commit graph

133 commits

Author SHA1 Message Date
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
464a3643c1 Remove unused Executor.makeObj() 2020-06-17 00:23:42 -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
13c66d7b82 fixed memleak when oldstyle unicode arrays are used 2020-01-03 19:29:40 +01:00
turleypol
da4ef6d950 added test for ++ member_id 2019-10-04 16:47:24 +02:00
turleypol
8f0da8b9e9 fixed refptr::set when given pointer is equal owned one.
Removed workaround in executor to temporary increase refcount of
BObjectImp
2019-09-26 21:50:23 +02: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
f5310f48f4 Merge remote-tracking branch 'origin/master' into utf8
* origin/master:
  Style...
  Getting rid of a warning
  Fixed wrong return type
  style issues :p
  Fixed the check for max line length and some other minor issues
  Added SocketLineReader class, which is responsible for reading lines from a socket in a more efficient way. Modified Aux, Debug and WWW to use the new class.
  removed some ancient macros from clib.h
  Added error for if NaN sent as PID
  Update docs to use different wording to prevent confusion.
  Updated Docs.
  Fix for GetProcess() not actually loading the parent PID.
  Update docs to use different wording to prevent confusion.
  updated travis build clang and ninja
  Updated Docs.
  Fix for GetProcess() not actually loading the parent PID.
  Improved network code used by http and aux servers

Conflicts:
	pol-core/doc/core-changes.txt
2019-09-02 18:55:07 +02:00
turleypol
691d330c07 removed some ancient macros from clib.h 2019-08-25 09:05:15 +02:00
turleypol
ebe884c2fe Merge remote-tracking branch 'origin/master' into utf8
* origin/master: (70 commits)
  Fix to items randomly loading with AOS props due to incorrect initalization of props on load of server.
  Rectify core not clearing mobiles from client during shadow realm shift.
  SendQuestArrow() fix for HSA clients (#91)
  Hotfix/start skill script (#90)
  Noninvasive dynaprops (#89)
  Update objref.xml
  Some network error conditions were missing...
  Final adjustments to core-changes
  Added Turley's missing core-changes :P
  Improved connection handling:  - Linux isn't limited to 1024 connections anymore  - Windows may have some slight performance boost
  removed senseless gitignore files
  use generator unspecific clean cmd in build_tools.sh always generate compile_commands.json force color diagnostic (to work with ninja)
  Curl building uses now the same compiler as pol
  fixed target_link_directories system header declaration
  check if container is orphan when adding items as content. for now it crashes the shard to have the backtrace. (would crash anyway later)
  add corechanges for doc changes
  new build target "clang_format" runs clang-format on current modified or new files in pol-core dir.
  Formatting
  Fix xml indentation
  fix indentation
  ...

Conflicts:
	pol-core/bscript/execmodl.cpp
	pol-core/doc/core-changes.txt
	pol-core/pol/getmsg.cpp
	pol-core/pol/module/unimod.cpp
2019-08-16 19:02:53 +02:00
turleypol
395083a31c memoryestimation did not add the module cost per executor
added EstimateSize util.em function returns estimated memorysize in
bytes of given argument. (docs to be done)
2019-02-01 23:18:43 +01:00
turleypol
ab89708107 completly converted all uses of convertArrayToUC, so all
functions/methods now accept arrays and strings
2018-12-31 16:25:34 +01:00
turleypol
3973851383 added getUnicodeStringParam needed for all the unicode em functions
which now accept only unicode arrays and should then also accept
strings
(arrays then only for backward compatibility)
2018-12-31 11:59:47 +01: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
892005f2b0 code simplification, deprecate warning for uoclient.cfg MethodScript
entry
2018-10-13 21:46:41 +02:00
turleypol
a5e6206164 Added cmake option to run clang-tidy
used everywhere nullptr
2018-10-09 16:36:35 +02:00
turleypol
0a39af15a1 Changed classes to be final if possible, removed override macro 2018-10-09 09:47:27 +02:00
turleypol
fd1dcb6512 switch tests where never executed :(
fixed unaligned load for switch statements
2018-06-03 21:54:16 +02:00
Gabriele Tozzi
72fc9d1ae4 Breaking long lines 2018-04-03 04:24:00 +02:00
turleypol
3afc41241b
CMake on windows (#48)
CMake can now also be used for windows
2018-02-24 22:34:55 +01:00
turleypol
2ba436bd56 protected functionref to be executed in a different script
added testscripts
2018-02-04 16:08:03 +01:00
turleypol
9d3cd4ffd5 fixed unittests, removed remaining debug prints 2018-02-04 12:56:08 +01:00
turleypol
d7fbb4ac8e cleanup debug prints
fixed funcref implementation
2018-02-04 11:58:26 +01: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
turleypol
798eda5b63 Cleanup of header includes. 2018-01-01 21:52:14 +01:00
turleypol
00ac2f834b Found the next easy bottleneck during method call. 2017-12-20 22:21:49 +01:00
Fernando Rozenblit
81ef24d781 UOExecutor now tells if the script could be suspended
Scripts which are running to completion outside the ScriptScheduler
can't be suspended. This will now be tested by the UOExecutor (as
os_module->suspend() doesn't care).
2017-07-30 20:10:19 +02:00
turley
a8a3dce207 removed pol.cfg entry to disable assertions, only hides the real
reason. Now all codepathes should complain about wrong version of em
files.
2017-05-28 14:15:26 +02:00
turley
f9c3db9e41 Modules share the same (helper) template base class
Optimize function name search for all modules not only uo by using an additional map, replaced c array with vector for functionsdef.
Simplified pragma pack order. (MSVC version is supported in all
compilers)
Removed compilerassert.h (asserteql,..) replaced with static_assert
Removed some old #ifs
2016-12-20 23:53:32 +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
Gabriele Tozzi
ff64e3b2b4 Minor: forcing SpinLock to be used only via SpinLockGuard 2016-02-03 06:08:26 +01:00
Gabriele Tozzi
d1ac902926 Documentation: reformatted headers for DoxyGen 2016-01-28 14:52:40 +01:00
Gabriele Tozzi
530790c8f8 Comparison operators refactor: better handle weird cases, cleaning
- obj.isLesserThan() and obj.ieEqual() are now replaced by < and ==
- Removed obsolete isLT(), isLE(), isGT(), isGE()
- Also implemented comparison operators for BObjectImp
- These operators may now be fully overriden in child classes
- Default implementations are derived from == and < operators
- As a general rule (that fit into "undefined" behavior":
-- Objects are == if having the same address
-- Objects are < based on their type ID, except of Error and Uninit
   that always are < everything else.
-- Objects are supposed to implement their own < and fall back to
   base class. If not implemented, as a last fallback, the object's
   address in memory is used to do the comparison
- Added test case for comparison operators
2016-01-24 22:22:45 +01:00
turley
6de0c7e1c0 added define to use boost regex (older gcc has bug in std version)
added define for the git revision and centralized others
2016-01-19 21:04:40 +01:00
frozenblit
ab592b0bf6 Instead of .c_str(), the log will take a copy of the formatter string 2015-05-16 16:00:26 +02:00
turley
dc3c54d3f0 misc stuff:
explicit initialization of some members
fixed a define
target cursor ids are now send 1-based instead of 0-based
clean up refpointers in sellhandlers after use (and not before)
iostats changed to atomics
2015-03-15 13:39:34 +01:00
turley
b77a13073c corrected several data races 2015-03-14 11:45:14 +01:00
turley
90f162924d Added override keyword to virtual functions 2014-11-23 15:07:02 +01:00
frozenblit
a704a90208 Another round of stl_inc.h cleanups 2014-11-01 22:27:42 +01:00
frozenblit
14e1f7579f Removed dead code 2014-10-06 20:24:25 +02:00
turley
e0b722a93b fixed several uninitialized variables 2014-08-30 12:25:08 +02:00
turley
38eb91dc7d fixed linux build 2014-08-15 15:43:54 +02:00
turley
1a054e76e3 moved some escript function names into flyweight. 2014-08-15 15:27:46 +02:00
turley
a2976bb31e nullptr guards for executor sizeEstimate() 2014-08-12 13:08:57 +02:00
turley
331792c755 added more memoryusage estimation 2014-06-07 09:00:37 +00:00
turley
fb873de803 decoupled headers to optimize a bit the build time 2014-05-03 09:06:19 +00:00