Commit graph

76 commits

Author SHA1 Message Date
Eric Swanson
e7b0dffc4c Fix compiler bug: user functions should be able to have the same name as module function parameter names 2020-07-16 20:04:20 +08:00
Eric Swanson
7a40423b7d Fix the fix 2020-07-16 20:04:20 +08:00
GIB
9d15f3ef45 Merge conflicts for rebase 2020-07-16 20:04:11 +08:00
Eric Swanson
1c3a96d2d6 Remove 'declare' keyword 2020-05-07 00:18:10 -07:00
Eric Swanson
38992ce457 Remove dead code from the compiler 2020-05-01 14:56:39 -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
Eric Swanson
3c1422a72e
Add Compiler::read_subexpression for DRY (#135) 2020-04-28 17:26:11 -07:00
Eric Swanson
88e22c1fcb
Make getUserArgs optimize arguments, rename Expression::eat2 -> consume_tokens (#134)
* getUserArgs: optimize arguments immediately

This would have also happened when the whole expression (function call + arguments) was processed.

Doing it here reduces the number of places that call IIP directly.

* remove dead code Expression::eat

* rename Expression::eat2() to consume_tokens(), and modernize
2020-04-28 14:02:16 -07:00
Eric Swanson
df5c3ced7b Move Expression class to expression.cpp/h 2020-04-24 13:37:26 -07:00
turleypol
8bbc8a19dd fixed compilation error 2019-10-07 21:12:45 +02:00
turleypol
59c816cab1 added ecompile.cfg and cmdline flag to trigger error when include
directives use the wrong capitalization. The existing warning will now
lead to an error when warnings get treated as errors.
2019-10-07 21:01:26 +02:00
turleypol
4ac7f227c7 ecompile now writes errors and warnings to stderr.
exit code is 1 when any compilation fails.
2019-10-05 13:19:38 +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
f1c30f05c3 changed endless if statement to switch 2019-09-21 21:33:34 +02:00
turleypol
20994e6b5f do not trigger a warning when ++i is the only statement in the line 2019-09-21 15:11:00 +02:00
turleypol
04066c309d moved unicode sanitize functions to clib as a preparation to sanitize
only once
renamed mklower/mkupper to make it clear that it should only be used
for pure ascii texts
compiler triggers only once a warning about invalid unicode file
2019-01-12 11:46:30 +01:00
turleypol
1898b1687c Merge remote-tracking branch 'origin/master' into utf8
* origin/master:
  fixed leak in compiler and xml filemod ecompile/runecl no longer try to log to pol logs activated xml unittest print stderr on testfailure

Conflicts:
	testsuite/escript/config/fileaccess.cfg
	testsuite/escript/filemod/xml.ins
2018-12-23 14:28:37 +01:00
turleypol
ea0c533364 fixed leak in compiler and xml filemod
ecompile/runecl no longer try to log to pol logs
activated xml unittest
print stderr on testfailure
2018-12-23 13:55:47 +01:00
turleypol
8d9de3918a Merge remote-tracking branch 'origin/master' into utf8
* origin/master: (58 commits)
  fixed style
  fixed namespaces of moved files
  moved polfile/uofile files into plib to cleanup atleast a bit the compile dependencies
  fixed cpu usage of usesinglethreadlogin
  fixed warning
  PolCore().internal(6, scriptname) logs name and memoryusage of variables for given script into log/scriptmemory.log. Globals, locals and all current call stacks. scriptname has to be the relative path from root with ecl ending. Precondition is an existing .dbg file for the given script, this will be created by compiling the script with -x
  added PolCore().internal(5) logs memoryusage in bytes of each script instance into log/memoryusagescripts.log
  updated flyweight memory report (used for memory saving of strings) enable via ENABLE_FLYWEIGHT_REPORT cmake option
  Turns out that Windows has the same wrong format specifier
  Fix wrong format specifier for pointers (fmtlib)
  Mentioned the ENTEREDAREA and LEFTAREA events for items in the docs
  Changed core-changes.txt so that there was only one date entry for my additions.
  Fixed more documentation errors for the ListObjectsInBoxOfClass and ListItemsInBoxOfObjType functions.
  Fixed prototype in XML docs for ListObjectsInBoxOfClass and ListObjectsInBoxOfObjType
  ** Fix docs for ListObjectsInBoxOfClass and remove commented debug code.
  **** Commit for 2018-11-25 **** Added ListObjectsInBox to uo.em.
  **** Commit for 2018-11-25 **** Added ListItemsInBoxOfObjType( objtype, x1, y1, z1, x2, y2, z2, realm := _DEFAULT_REALM) to uo.em Updated core-changes.txt with the ListItemsInBoxOfObjType info. Updated uo.em docs with the ListItemsInBoxOfObjType info.
  silence old core-changes.txt format warnings
  Update web server docs.
  More gitignore
  ...
2018-12-22 10:43:32 +01:00
turleypol
bbc3cae53e fixed reported warnings from coverty 2018-11-01 17:57:03 +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
366f7e7122 Merge remote-tracking branch 'upstream/master'
* upstream/master: (45 commits)
  renamed mobile syshook to character used unique_ptr for all syshooks
  added docs
  code simplification, deprecate warning for uoclient.cfg MethodScript entry
  party and guild ref support docs and testing left?
  custom methods for client and account references
  fixed line length
  syshooks for npc/mobiles
  first round for scripted object class methods
  Fixed formatting error.
  Added new return option to consume ammunition hook which allows the hook to make the core continue with the usual ammunition checks.
  Fix critical bug in FindObjtypeInContainer()
  fixed compiler warning
  fixed linesize
  windows fixes
  Added cmake option to run clang-tidy used everywhere nullptr
  Changed classes to be final if possible, removed override macro
  Added additional documentation.
  next..
  clang 7 is currently untrusted... next try 6 ;)
  fixed new clang warnings, new compiler version on travis (lets see how many commits are needed till it works)
  ...

Conflicts:
	.travis.yml
	pol-core/bscript/impstr.h
	pol-core/clib/cfgfile.cpp
	pol-core/pol/module/npcmod.cpp
2018-10-14 14:00:33 +02:00
turleypol
0864d3a31e fixed linesize 2018-10-09 19:07:53 +02:00
turleypol
a5e6206164 Added cmake option to run clang-tidy
used everywhere nullptr
2018-10-09 16:36:35 +02:00
turleypol
72574d581b compiler can now handle files with BOM 2018-06-25 19:31:00 +02:00
turleypol
ea0f465e6d Some better error handlings 2018-04-27 23:08:26 +02:00
Gabriele Tozzi
b72f725e02 Whitespace fixes 2018-04-03 04:13:03 +02:00
turleypol
3afc41241b
CMake on windows (#48)
CMake can now also be used for windows
2018-02-24 22:34:55 +01:00
Kevin Eady
66da8ac805 Changed reference to unary @ operator 2018-02-05 19:21:27 +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
turley
842dde97c0 dead code 2016-12-09 20:59:13 +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
d1ac902926 Documentation: reformatted headers for DoxyGen 2016-01-28 14:52:40 +01:00
Gabriele Tozzi
5bf416ca24 Merge branch 'cmake'
Conflicts:
- pol-core/clib/xmain.cpp
- pol-core/ecompile/ecompile.cpp
2015-12-18 23:41:43 +01:00
Gabriele Tozzi
144f0600f7 Documentation: improving comments in code
Most of them coming from the "unicode" branch
2015-12-15 02:53:58 +01:00
Gabriele Tozzi
1cd1e5c7bf Documentation: added some comments in ecompile
Also removed a couple of unused functions from the header file
2015-12-10 22:41:14 +01:00
Gabriele Tozzi
24eee9ecf4 Merge branch 'master' of https://github.com/polserver/polserver into cmake
Conflicts solved, still need to test and review it before merging into master.
2015-11-27 06:26:46 +01:00
Thomas Volkert
0a0d1974a8 Fixed Windows build for clib 2015-11-11 00:34:18 +01:00
Gabriele Tozzi
70f83638dc Fixed: minor bug in the compiler handling "unused" keyword
It was partially ignoring DisplayWarnings and ErrorOnWarning settings
2015-09-06 05:27:37 +02: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
ab592b0bf6 Instead of .c_str(), the log will take a copy of the formatter string 2015-05-16 16:00:26 +02:00
frozenblit
1ba2462cb6 More and more stl_inc.h cleanups 2014-11-01 20:09:12 +01:00
frozenblit
1253a43b12 Error checks in Compiler::getFileContents() 2014-09-28 13:44:57 +02:00
turley
e0b722a93b fixed several uninitialized variables 2014-08-30 12:25:08 +02:00
turley
1a054e76e3 moved some escript function names into flyweight. 2014-08-15 15:27:46 +02:00
turley
c8d89959a0 simplified flexlogger a bit, returns filename to identify the logfile, optional logfileopend timestamp 2014-06-13 18:32:26 +00:00