Commit graph

130 commits

Author SHA1 Message Date
turleypol
a1864581a0
Use mariadb connector as a replacement for mysqlconnector (#872)
* silence cppdap lib

* refornat curl flags for readabilty

* zlib was build with the wrong runtime mode. Updated version

* use mariadb connector instead of mysql

* removed mysql define

* removed mysql

* removed installation of mysqlclient in workflow runs

* fixed curl install dir

* missing zstd on macos

* fixed module parsing for cmake 4.x

* docs

* added mariadb build to tidy_pr_check

* test sql on all platforms
some plugins need to included on windows
2026-03-30 22:50:24 +02:00
turleypol
77637b29f0
removed google-benchmark from repo, download when needed (#860)
increased minimal CMake version since efsw needs this version
2026-01-20 07:57:43 +01:00
Kevin Eady
0790397c8a
Fix parsing issue introduced with regular expressions when using floating-point dividends (#832)
* do not allow regex after a float token

* docs
2025-12-14 19:44:13 +01:00
Kevin Eady
5cf6949ea7
Add support for regular expressions (#818)
* implementation

* tests

* maybe fix windows compilation?

* undo change of match_flag_type

* switch to boost regex

* move flags to BRegExp object

* fix tests due to cmake 4 update

* update grammar

* update prettifier

* move flag parsing to BRegExp ctor

* add AST nodes, update instr generation and execution

* copy tests but use regular expression literals

* fix grammar for handling division correctly

* modify return values a bit, update tests
- string.match: make groups hold structs of matched, offset
- string.match: add offset
- string.replace: use a groups array like string.match vs individual arguments

* bundle of changes

- standardize error messages
- add more tests for coverage
- move BRegExp creation to static method:  previous implementation had
  ctor throwing, which was no good inside executor since it didn't have
  a try/catch

* more tests; add OT_REGEXP to basic.em

* move string regex stuff to bregexp and support regex/wregex via std::visit

* maybe fix compilation errors?

* add unicode escape sequence handling

* really maybe fix compilation error?

* fix compiler warnings

* refactor a bit to remove duplicate code

* address discord comments
- just return wstring, no need for vector<wchar_t> method

* Add string.split by string and regexp

* Use Max_Split instead of Limit
This makes it match basic::SplitWords

* add support for empty string delim in SplitWords

* remove duplicate code across string.split and mf_SplitWords

* Squashed commit of the following:

commit b3148e069f
Author: turleypol <turley@polserver.com>
Date:   Sat Sep 27 17:02:22 2025 +0200

    memorylocation of input string is not allowed to changed, switched back
    to uniqueptr

commit 5a4d1c8fcb
Author: turleypol <turley@polserver.com>
Date:   Sat Sep 27 10:18:01 2025 +0200

    no need to use ptr for input

commit 90fa0edc66
Author: turleypol <turley@polserver.com>
Date:   Sat Sep 27 09:56:29 2025 +0200

    fixed typo

commit bed4ff3ac9
Author: turleypol <turley@polserver.com>
Date:   Sat Sep 27 09:47:36 2025 +0200

    make Callback for BContinuation move only

* use uninit when group isn't matched

* fix multiline flag handling; add test

* add docs and doc example tests

* some cleanup

* address review comments
- allow move assignment

* add core-changes
2025-11-17 18:02:45 +01:00
Kevin Eady
c286b49858
Fix handling of byref, rest, and default parameters in uninitialized functions (#814)
* Update grammar

* update prettifier

* Update semantic analysis
- Move checks for 'super' and non-static to semantic analyzer
- Add checks for byref and default

* Add, update tests

* update escript guide, add tests for examples in guide

* update core-changes

* Address Discord comments
- Update core-changes to explicitly talk about default parameters
2025-09-06 17:26:06 +02:00
Kevin Eady
ddc1b5d26b
Add Escript support for uninitialized class functions (#808)
* update grammar

* AST nodes and test

* Address self-review comments
- Replace `super` comment with something more explanatory
- Rename `make_user_function`

* add class analysis for uninit functions

* fix ast test after disallowing static uninit funcs

* use std::ranges::find_if

* add tests

* use SUPER constant; add test

* Remove unreachable code leftover from #809

Since #809, the super function is only generated for a class when
registering a parent class, and therefore it will always have a body. A
"No base class defines a constructor" will only occur if super was never
generated, and is handled in the "No function linked through
FunctionResolver" section of semantic analyzer.

* Address review comments
- use std::ranges::move instead of move iterators
- use std::is_same_v<> vs std::is_same<>::value
- use switch vs chained ternary conditionals

* update escript guide, create tests that are in escript guide

* add core-changes

* Error on uninit and defined constructor

* Move methods' FunctionLink construction to builder

This allows the error message for the uninit function to have a "See
Also" that point to the defined function.

* Move error checks for uninit and defined functions

These semantic checks should be in the ... SemanticAnalyzer.

* fix typo in core-changes
2025-09-05 23:23:59 +02:00
Kevin Eady
0fcc5060af
Enum class fixes (#805)
* fix enum classes entries without initializer

* docs

* update grammar to support scoped identifiers in case labels

* add support for enum class constants in case statements

* add ScopableName to ConstDeclaration; formatting fixes; tests

* update docs
2025-08-19 09:07:02 +02:00
Kevin Eady
003274de55
Add Escript support for enum class (#804)
* update grammar

* implementation

* tests

* docs and core-changes

* cleanup old .cot files

* add error on duplicate class, enum class definition; tests

* Fix compiler warnings

* add test for unscoped identifier failure
2025-08-18 20:50:18 +02:00
turleypol
21819aacee
Download more external libs from official GitHub repos (#787)
* download Curl, Kaitai, PicoJson, Utf8, ZLib from github
updated versions

* typo

* updated curl cache
2025-06-25 19:55:42 +02:00
turleypol
3bf1af9892
Updated fmt lib to latest release, fixed unreachable code warnings (#786)
* updated fmt to 11.2.0
compile on windows with utf8 activated
added missing include

* fixed unreachable code warnings
mostly constexpr if statements

* removed forloop since it triggers unreachable code warning when it
breaks always after first iteration.

* delay debugger testscript end

* removed fmt lib from repo and download from github
2025-06-24 19:53:21 +02:00
Kevin Eady
1de9d3a9f6
Update ANTLR to cb85012 (#777) 2025-04-12 22:51:11 +02:00
Kevin Eady
6c7a2b0a30
Add support for spread operator in dictionary and struct initializers; FormatterEllipsisSpacing formatter option (#763)
* update grammar

* implementation

* formatting

* executor implementation, tests

* docs, core-changes

* fix warning introduced in #760

* add format option FormatterEllipsisSpacing

* update core-changes
2025-02-19 18:33:56 +01:00
Kevin Eady
ec344a395d
Add support for sequence and index bindings (#760)
* update grammar

* add ast nodes; ast building

* Rename to unpacking

* semantic analysis

* executor work part 1, unpacking indices

* renamings; implement index binding

* small cleanup

* use multi_index; more tests

* use multi_index only for rest, otherwise list

* initial formatting

* add missing token decoding

* address self-review comments

* formatting tweaks

* add test for var binding in classes

* add StringIterator

* fix spread tests

* add cfgfile iterator; add cfgelem opersubscript; tests

* add iterator for SQLResultSet and SQLRow; tests

* Copy value in take global/local

* Allow any iterable can index rest unpacking
Always use dictionary as rest object in index unpacking

* add docs, core-changes, doc tests

* formatting changes...

* address self-review comments

* update formatter, format all binding test srcs

* address review comments
- unset var scope

* add cfgfile/cfgelem docs

* reformat objref svg
2025-02-17 21:59:42 +01:00
turleypol
59bf1ffeb9
updated clang, gcc to newer version (#740)
updated picojson to latest
updated cmake and ninja to latest
2025-01-05 17:48:52 +01:00
Kevin Eady
00b928217a
Fix infinite loop in lexer on EOF in FORMAT_STRING (#722) 2024-10-17 06:54:28 +02:00
Kevin Eady
d7cdcff383 Add classinst.function member; Add is binary operator; Add funcref MTH_NEW (#701)
* Update grammar

* Implement selfIs in BObjectImp

* Add tests

* Update grammar

* Support obj.function as a MemberAccess [1/2]
- AST generation changes

* Support obj.function as a MemberAccess [2/2]
- add funcref index to eprog class table ctor entry
- allow check_mro on non-class inst (skip ctor calls)

* Move address of funcref into funcref table

* Add funcref.new()
- Add class index to funcref table entry
- Add MTH_NEW

* Fix formatting

* Address self-review comments

* Some more tests

* Address self-review comments

* Update grammar

* Remove ObjMember read_only, hidden
No need to special-handle MBR_FUNCTION

* Addres GitHub CI annotations
- '=': conversion from 'size_t' to 'unsigned int', possible loss of data
2024-10-10 18:06:04 +02:00
Kevin Eady
6838c74cb4 Add super() function call for constructors (#694)
* Grammar updates
- Make class parameters required

* Add ClassLink; wip with `super()` calls in ctors

* More AST nodes as ScopableNames
- (function call) Argument
- FunctionParameterDeclaration

* Add support for ambiguity handling

* Add few more tests

* Handle returns in constructors
- Semantic analysis to error on returning a value
- Introduce specific emitter method for returning from constructor
- Various tests

* Refactor super building to pre-semantic analysis

* Adding several tests, some are TODO
- found an issue with function resolver and funcrefs, fix later

* Address self-review comments

* Fix funcref global func references, tests
2024-10-10 18:06:04 +02:00
Kevin Eady
e3512d001b Add scope handling for functions and variables (#690)
* Add Report.debug

* Implement function call scoping

* Implement variable scoping
- Rename `Identifier::scope` to `calling_scope`, and concatenate the identifier scope into `name` if necessary.
- Track current scope in SemanticAnalyzer, similar to UserFunctionVisitor.
- Use current scope in SemanticAnalyzer when visiting identifiers.

* Update grammar for `::identifier` global scoping

* Introduce ScopableName for function resolution

* Address review comments
- Check for display_debugs missing

* Add ScopableName for identifier resolution

* Some cleanup
- Remove `Identifier::calling_scope`, as it is tracked in the semantic
  analyzer
- Refactor `ScopeName::exists` to `global` for better clarification of
  its use
- Removed `X::maybe_scoped_string/name`

* Address self-review comments

* Rename `Function::module_name` to `scope`
2024-10-10 18:06:04 +02:00
Kevin Eady
4ae9519343 Update grammar, parser, semantic analyzer for classes; skeleton codegen and executor (#688)
* Update grammar

* WIP with tracking classes
- Refactor AvailableUserFunction to AvailableParseTree
- Track ClassDeclarationContexts similarly to user functions

* Skeleton AST + tracking

* Finish up AST building

* Implement AST building
- TODO decide better name for UserFunctionBuilder/Visitor,
since it does both user functions and classes

* Update Prettifier

* Crude, first-round semantic analysis + codegen
- Currently, no real difference from regular functions

* Move class var statements to top level statements

* Add semantic analysis for base class existence

* Introduce ClassInstance AST node for generating `this` parameter

* Skeleton create class instance instruction

* Default ctor; 'this' byref; Error if multiple same baseclass

* Update grammar for scoped funcrefs and scoped identifiers

* Update prettifier, builders for scoped funcref, identifiers

* Fix CI issues
- Styling
- Shadowing

* Add grammar tests for scope; Remove scope from switch label

* Final draft todos
- Rename `VarStatement::class_name` to `scope`
- Comment why identifiers dont have scopes in enum declarations
- Remove code comment
2024-10-10 18:06:04 +02:00
Kevin Eady
a780712ec7
Add spread operator for array initializers, function calls, and method calls (#684)
* Update grammar

* Update parser and AST generator

* Update semantic analysis, tests

* Handle instruction generation

* Executor implementation
- Instruction `ins_storestackcount`
- Instruction `ins_spread`
- Update listfile tests for new `storestackcount`` instruction

* Add tests targetting resource tracker

* Revert "Executor implementation"

This reverts commit f0caede24179cb11b6d98c8cd1fecd91ce546148.

* New instruction implementation
- Introduce `BSpread` object to manage spreading an object at runtime.

* More tests

* Fix memory leak

* Add test spreading non-arrays

* Add failure reason to bfunc method call
Better than getting uninit

* Core changes; docs + accompanying tests for docs

* Resolve CI annotation warnings
- this statement may fall through

* Fix listfile snapshots due to base rebase, whoops
2024-08-06 23:34:24 +02:00
Kevin Eady
93645f0770
Add variable arguments to user functions (#679)
* Update grammar

* Update parser and AST generator

* Update semantic analysis

* Executor implementation
- Move Executor stack modification logic to BFunctionRef
- Handle user function calls
- Handle expression function calls

* Tests

* Update existing listfile snapshots
- Adds variadic boolean to instruction stack
- Changes instruction counts and offsets

* Fix test issue

* Better implementation of calling user functions

* Add var-args-captures test

* Refactor continuation handling + handle variadic args
- Move stack modifications from make/withContinuation into the executor's handling of the continuation
- Only trim args in continuation call if function is not variadic

* Add var-args-continuation test (via array.filter)

* update escriptguide + formatting, docs

* Fix CI annotations
- '=': conversion from 'size_t' to 'unsigned int', possible loss of data
- declaration of 'continuation' hides previous local declaration
2024-08-04 17:13:30 +02:00
Kevin Eady
f381f46dc3
Add compiler support for function expressions (#671)
* initial poc of function expressions
- update grammar
- mock AST builder to return BBoolean(true) for a func expr
- update prettifier for skeleton implementation

* more skeleton work
create AST class FunctionExpression mimicking boolean value

* create ast UserFunction, add to workspace from functexpr

* can generate instructions

* reorg tests; add test for instructions

* can track FunctionDepth in Variable

* can get captures for funcexprs inside funcs.. tbd if this way of nesting works

* Implement create-functor instruction
- Move function depth from Variable to Variables
- Introduce stacking of `Variables` for function expresions via `FunctionVariableScope`
- Add `TOK_FUNCTOR` instruction for 'create-functor'
- Handle emitting a `FunctionExpression` AST node
- Update `emit.declare_variable` and `emit.access_variable` to account for function captures
- Remove `in_function` from instruction generator, as it is tracked via `UserFunction` stack
- Update tests

* Address Discord comments
- Swap pop param order

* Bubble up captured variables through nested functions

* Improve testing infrastructure; add some test cases

* Fix compilation error

* prepend captures to function parameters in funcref mth_call

* update tests

* move from function{} to @{}

* implementation fix

* some more tests

* update docs

* Some cleanup

* fix CI annotation warning
- 'argument': conversion from 'size_t' to 'VariableIndex', possible loss of data

* Address review comments
- Add `passert_always`
- Use better example in docs

* Some cleanup
- Remove unused functions
2024-07-29 22:30:52 +02:00
Kevin Eady
f47ce97d26
Add compiler support for expressions as function callee (#670)
* initial support for function calls with expression callee

* Add support for identifier-named callees

* add compilation failure test; better code docs

* Add core-changes

* Address compiler warnings
- conversion from 'size_t' to 'unsigned int', possible loss of data

* Update grammar

* implementation

* tests

* update core-changes

* Address CI warnings
- declaration of 'method' hides previous local declaration
2024-07-28 20:21:23 +02:00
Kevin Eady
62a252ad3a
Add daemon watch mode to ecompile (#630)
* Add libefsw at 3419347

* saving work

* some cleanup

* move to fs::paths

* saving work.. maybe hitting a limit with number of watched dirs?

* migrate to watching only ecompile.cfg specified folders, cleanup/doc

* Display summary between compilations in watch mode; fix cache reuse

* Fix inf loop; some cmake, format changes...

* some windows compilation fixes... tweaks to windows cmake?

* Update Efsw.cmake for build lib changes

* removed debug flag

* silence efsw build
dont add antlr project if it already exists

* Address review comments:
- use std::move on efswwatcher add_*

* add docs

* Add WatchModeByDefault ecompile.cfg option

* iniital work on tests

* Add CI actions

* some changes (passes locally on win, mac, linux)

* Fix fixtures dependency; use ecompile verbose mode

* Add core-changes

* Send ctrl+c instead of killing process

* Proper Python file naming

* Kill ecompile process on windows, SIGINT otherwise

---------

Co-authored-by: turleypol <turley@polserver.com>
2024-03-16 00:08:06 +01:00
Kevin Eady
2de1995c19
Fix compiler for escaping } correctly in interpolated strings (#620)
* Update grammar; add tests
String literals inside an interpolated string cannot start with `}`, as it must be a DOUBLE_RBRACE `}}`

* Fix interpolate string token reading

* Update core-changes
2024-02-06 10:44:26 +01:00
Kevin Eady
d4850d8049
Tweak parse tree to treat uninit and bools as literals (#616) 2024-02-01 15:21:52 +07:00
Kevin Eady
686090d950
Introduce DAP Debugger (#608)
* Add cppdap debugger library and simple server (#508)

* Add cppdap library

* Add cppdap server

* fixup cmake scripts for windows

* Enable caching of cppdap on GitHub actions

* Fix CMake for cppdap target

* Wait 1s for session close before thread ends

* Address review comments
- Remove unnecessary use of wait_for
- Fix wait_for method

* Do not use SocketClientThread for cppdap clients

* Address review comments
- Cleanup object ownership

* Add authorization and event handling (#510)

* Add authorization and event handling [WIP]

* Use std::weak_ptr; Only allow one debugger conn

* Only attach debugger if dbg file exists

* Cleanup weak_ptr; Fix listeners; Add handler stubs

* Address review comments
- PolLock on uoexec and weakptr access
- Use make_shared when creating client thread

* Add ExecutorDebugListener on_destroy callback

* Use cppdap sockets instead of clib sockets

* Update cppdap repository to 2703cf4

* Implement server address binding

* Update cppdap repository to eeca5ce

* Fix warnings

* Use weak_from_this

* Fix stalled executors on disconnect

* Fix stalled executors on re-attach

* Clear uoexec weakptr on all debugger detaches

* Move server to gamestate

* move DapDebugServer into Network namespace

* move DapDebugServer into GameState for storage

* Move DapDebugServer into NetworkManager

* Fix missing memory include

* Add more events (#513)

* Add more events

* Implement dbg_step_out

* Fix breakpoint clearing

* Add even more events (#515)

* add launch request

* Add custom `processes` command

* fixup loop

* Refactoring to move handlers to member functions

* Add VariablesRequest and ScopesRequest

* use std::varaint for Handles

* add pollocks

* refactor Handles to new file

* move custom messages to proto.h

* move clientthread

* some formatting / cleanup

* Add missing PolLock

* move dap variables creation to Handles

* appobj members

* rename ClientThread to DebugClientThread

* rename LaunchRequest args to arg

* Fix compiler error on size_t

* Add support for EvaluateRequest and SetVariableRequest (#519)

* Update grammar for evaluateUnit

* Cleanup various compiler code

* Add support for EvaluateRequest
Only supports values, variables, element access, member access

* Add report clearing to reinitialize state

* Add support for SetVariableRequest

* Fix CI build errors

* Move ExpressionEvaluator to Bscript

* Fix formatting

* Fix include

* Refactor global and frame variable references

* Encapsulate Executor debugging environment; Fix step over (#524)

* Fix step over

* Some cleanup of executor
- Remove unused debug states
- Rename members for consistency

* move debugging environment to new class

* Move instruction inspection to class

* Cleanup slashes on Windows; Add Executor state to processes response (#527)

* Fix backspaces in script names on Windows

* Fix compilation warnings with data loss

* Use boost::icontains for string comparison

* Add Executor state to processes response

* Updates for libfmt

* Fix tests; Fix cppdap build for Mac universal binary (#607)

* fix tests

* fix cppdap build for mac universal binary

* Update cppdap to 2a4c7cf

* Add tests; Modify launch behavior to not stop at entry (redo) (#609)

* Remove unused setExceptionBreakpoints handler

* Add debugger tests

* Launching a script should not set attaching state

* Add launch tests

* Do not check for connection in debugger tests

* Rename `program` to `script` in protocol structs

* Fix launch stopAtEntry; quote string var values

* Fix compilation error on Windows

* Add configfiles doc entry

* Various fixes for finishing touches; Add core-changes (#610)

* switch cmake projects

* simple docs

* cmake move make_directory

* Fix launch request with relative, absolute, package paths

* make relative paths as absolute in source request

* Add true, false, uninit to ExpressionEvaluator

* Re-add setExceptionBreakpoints to avoid unhandled message errors

* Better debug thread logging with instance numbers

* launched scripts should terminate on disconnect (according to DAP spec)

* Properly handle exited event in client thread

* Add core-changes

* Address Discord comments
- Mention vscode-escript in core-changes
- Re-add "cppdap already built" in cmake

* change cmake escriptgrammarlib visibility to public
2024-01-28 09:49:55 +01:00
turleypol
271a1105ba
added explicit targets for every 3rd party lib (#612)
* added explicit targets for every 3rd party lib
these contain include dirs/libs/compiler defs

* moved each 3rd party lib into a version folder, to give each target a
dedicated include directory.
Now noone should add lib root folder as include dir
Used private linking where possible
disabled building of boost, wasnt used at all

* regnerate boost cache
adapted targets for coverity
2024-01-27 09:06:23 +01:00
turleypol
08bd3c7ce5
Savefile rewrite (#601)
* rewrite of saving, replaced operator way with a generic add method, thus
not everywhere the formating of the savefiles is hardcoded.
since its the last spot which uses the old formating lib, remobed the
lib

* removed cmake of old format lib

* testscripts for load/save of UObject,Item,Armor,Weapon

* fixed: member faster_cast_recovery and faster_cast_recovery_mod getter returned
a wrong value

* wrong/missing docs

* test containers, lockable, map, spellbooks
fixed save bug in map and spellbook
removed ancient savestrategy experiments

* added corpse test
splitted testfiles

* fixed loading (ancient bug) and saving (PR bug) of Reportables
added tests for houses, boats, accounts and chars

* fixed include

* fix shutdown leak

* added npc tests
upload complete coretest folder also on failure

* do not write and load RegisteredHouse for NPCs two times
readded extra newline between accounts

* tests for guild, party, realm
added resource cfgs, but a test is not really possible since nothing of
interest is stored

* added datafile, storage test

* activated resource loading, 25year old bug, but since the stored values
are senseless it makes no real difference.
added a few wtf comments
catch all exceptions during formatting of log lines

* replaced .write with explixit .begin, .end and .comment.
for leftovers.txt the StreamSaver was also used, since the format is
different use directly ofstream

* added corechanges
2024-01-24 18:49:06 +01:00
Kevin Eady
593cfffb83
Add uninit, true, false keywords to grammar (#596)
* Update grammar

* Update expression handling for uninit

* update existing tests

* Add new tests

* Remove fullpath from escriptgrammar generation comment

* fix tests

* Update eScript guide

* Declare escript version 0x11

* Add core-changes

* Add `true` and `false` to grammar

* true/false implementation

* Fix existing tests

* Add new tests

* Update core changes

* add docs

* Fix BooleanValue::describe_to

* bool optimizations

* optimize uninit

* remove unused var assignments

* Update grammar for case labels for uninit, booleans

* Fix case label handling for uninit, true, false

* Tests

* Fix compiler version display v1.1700000017881393 -> v1.17

* optimize boolean binary operations

* fix unary boolean optimizer

* add boolean, uninit optimizer test

* Use new fmt lib apis

* Fix compiler warning

* really fix warning lol

* Add Executor[Module]::getParam for bools, FindSubstance test
2024-01-20 05:38:25 +01:00
turleypol
43b776b94d
New format lib version (#592)
* renamed include guard to be able to use both format lib versions in
parallel

* build Fmt lib and link it into clib

* use std::string instead of format Writer for logging
added variant "2" for logging with new fmt lib

* use new logging variant for two logs

* always add \n to flush log, lets see if the assumption holds

* use new lib for tostring

* replaced all INFO_PRINTS in clib

* formatter for Token, BObject and BObjectImp

* started with bsccript

* use function instead of actual object for logging

* remaining bscript, started plib

* logvariant without newline added, more template magic

* format support for base types, added test for format padding
new version for fdump

* chanhed ecompile/runecl fixed compilation with ESCRIPT_PROFILE

* rewrite INFO_PRINT in plib,poltool/uoconvert/uotool

* replaced remaining INFO_PRINTS, renamed macros INFO_PRINT for logging
without newline, INFO_PRINTLN for newline addition.
Replaced also INFO_PRINT_TRACE and renamed it to INFO_PRINTLN_TRACE

* gitignore for fmt lib

* cleanup vim leftovers
2024-01-10 18:29:10 +01:00
turleypol
8e0995894a
adapted gitignore for new kaitai (#590) 2024-01-07 10:46:46 +01:00
turleypol
07296458fa
New Kaitai version (#589)
* updated Kaitai version, use shipped CMakeList.
Added imported library target for easier integration

* replaced debug CMakeList with original
2024-01-04 23:28:12 +01:00
turleypol
5744049e26
Antlr4.13.1 (#582)
* remove windows headers from "public" headers, stlutil and pch.

* update antlr, regnerate EscriptGrammar

* CI antlr cache

* added now missing header
2023-12-26 11:15:15 +01:00
Kevin Eady
2bd76b9004
Upgrade boost to 1.83.0 (#552)
* Upgrade boost to 1.83.0

* Add /MT for Windows compilation
2023-10-16 07:46:59 +02:00
turleypol
553b8b8030
updated zlib to version 1.3 (#537) 2023-08-27 17:08:04 +02:00
Kevin Eady
3aeab1b165
Update libcurl to 8.2.1 (#536)
* test new curl

* no clue

* update gitignore for curl

---------

Co-authored-by: turleypol <turley@polserver.com>
2023-08-26 13:42:10 +02:00
Jakub Kalita
67acb43264
Fixed reading map properties + VS2022 boost update (#455)
* Fixed reading map properties.
* Updated boost version to enable VS2022 builds.
2022-02-18 19:01:40 +01:00
Kevin Eady
c6301c0c52
Fix constant declaration production (#399)
* Fix constant delcaration production

* Add tests
2021-04-19 21:58:36 +02:00
Kevin Eady
0ca7912fcd
Add support for conditional operator (#387)
* Grammar update

* AST generation

* Emit instructions

* Add initial tests

* Additional tests

* Rename to ConditionalOperator

* Add docs
2021-03-14 23:20:20 +01: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
Kevin Eady
44c864b917
Remove erroneous lexing productions (#371)
* Remove erroneous lexing productions

* Fix hex float literals

* Address review comments.
2021-02-27 23:54:07 +01:00
Kevin Eady
b1e8d2b36a
Fix escape sequences, double-slash in strings (#368) 2021-02-22 21:20:55 +01:00
Eric Swanson
1adcab5644
Upgrade boost to 1.74 (#340)
* boost 1.69

Due to this: https://github.com/boostorg/atomic/issues/15

* build boost with libs for asio

* Boost 1.74

Download from dl.bintray.com/boostorg/ because Boost 1.74 .bz2 is larger than GitHub will allow without LFS

* set BUILD_BYPRODUCTS (just setting one library, and doesn't handle windows..  I don't know what is correct anyway)

* build with b2

* Try Boost.cmake from Kevin

* Specify toolset in configure command line

* Use POL_EXT_LIB_DIR.  Make clib depend on boost, not pol itself

* cache boost for github actions

* Copy-pasta correction

* Cache boost for additional github build workflows

* cache boost for coverage build, updated cache action version

Co-authored-by: Kevin Eady <8634912+KevinEady@users.noreply.github.com>
Co-authored-by: turleypol <turley@polserver.com>
2020-12-23 12:11:32 +01:00
Eric Swanson
203db02d48
New compiler: Move precedence of "in" above comparison operators (#316)
Rationale:
  a in b == x in y   // membership in two things is the same
  a in b != x in y   // membership in two things is different
  a in b <= x in y   // a has at most as much membership in b as x has in y
  a in b <  x in y   // a has less membership in b than x does in y

This matches Kotlin precedence for this operator https://kotlinlang.org/docs/reference/grammar.html#expressions
2020-09-15 06:48:36 -07:00
Eric Swanson
00904c02c8
Adjust operator precedence for bitwise operators: (#315)
- Moved <<, >>, & to same level as multiplication
- Moved | and ^ to same level as addition
2020-09-15 06:03:05 -07:00
Eric Swanson
591eb37d04
New compiler: No longer reserved words: null, declare (#313)
* These are not reserved words:
  - null
  - declare

Fixes https://github.com/polserver/polserver/issues/309
2020-09-15 00:16:31 -07:00
Eric Swanson
92098e3784
grammar: report trailing commas in dictionary, struct, array initializer lists (#252) 2020-08-29 02:52:40 -07:00
Eric Swanson
d456cc98eb
Update compiler grammar (#238)
* Update grammar
  - add '=' to grammar so that we can report appropriate errors
  - add elvis ?: operator
  - add foreachIterableExpression to match old compiler (which only allows certain expressions)
  - allow both byref and unused on the same function parameter
  - rename methodCall -> functionCall
  - rename memberCall -> methodCall
  - add named parser rule for functionReference
  - move everything that isn't expression(s) with operators into primary
    - expression is now just the left-recursive rules and prefix operators
  - add named parser rules for struct, dictionary, error, array initialization
  - remove special-case for named parameters with := from function call argument, because it is ambiguous with assignment
  - Moved array access, object member access, and object method calls to navigationSuffix

* Regen grammar
2020-08-21 01:53:42 -07:00
Fernando Rozenblit
f3c3dbd0cf
Remove unused library and header (#218) 2020-08-14 21:38:02 +02:00