polserver/pol-core/bscript/CMakeSources.cmake
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

409 lines
14 KiB
CMake

set (bscript_sources # sorted !
CMakeSources.cmake
StdAfx.h
StoredToken.cpp
StoredToken.h
compiler/Antlr4Inc.h
compiler/Compiler.cpp
compiler/Compiler.h
compiler/analyzer/Constants.cpp
compiler/analyzer/Constants.h
compiler/analyzer/Disambiguator.cpp
compiler/analyzer/Disambiguator.h
compiler/analyzer/ExpressionEvaluator.cpp
compiler/analyzer/ExpressionEvaluator.h
compiler/analyzer/FlowControlScope.cpp
compiler/analyzer/FlowControlScope.h
compiler/analyzer/FlowControlScopes.cpp
compiler/analyzer/FlowControlScopes.h
compiler/analyzer/FunctionVariableScope.cpp
compiler/analyzer/FunctionVariableScope.h
compiler/analyzer/LocalVariableScope.cpp
compiler/analyzer/LocalVariableScope.h
compiler/analyzer/LocalVariableScopes.cpp
compiler/analyzer/LocalVariableScopes.h
compiler/analyzer/SemanticAnalyzer.cpp
compiler/analyzer/SemanticAnalyzer.h
compiler/analyzer/ShortCircuitWarning.cpp
compiler/analyzer/ShortCircuitWarning.h
compiler/analyzer/Variables.cpp
compiler/analyzer/Variables.h
compiler/ast/Argument.cpp
compiler/ast/Argument.h
compiler/ast/ArrayInitializer.cpp
compiler/ast/ArrayInitializer.h
compiler/ast/BasicForLoop.cpp
compiler/ast/BasicForLoop.h
compiler/ast/BinaryOperator.cpp
compiler/ast/BinaryOperator.h
compiler/ast/BinaryOperatorShortCircuit.cpp
compiler/ast/BinaryOperatorShortCircuit.h
compiler/ast/BindingStatement.cpp
compiler/ast/BindingStatement.h
compiler/ast/Block.cpp
compiler/ast/Block.h
compiler/ast/BooleanValue.cpp
compiler/ast/BooleanValue.h
compiler/ast/BranchSelector.cpp
compiler/ast/BranchSelector.h
compiler/ast/CaseDispatchDefaultSelector.cpp
compiler/ast/CaseDispatchDefaultSelector.h
compiler/ast/CaseDispatchGroup.cpp
compiler/ast/CaseDispatchGroup.h
compiler/ast/CaseDispatchGroups.cpp
compiler/ast/CaseDispatchGroups.h
compiler/ast/CaseDispatchSelectors.cpp
compiler/ast/CaseDispatchSelectors.h
compiler/ast/CaseStatement.cpp
compiler/ast/CaseStatement.h
compiler/ast/ClassBody.cpp
compiler/ast/ClassBody.h
compiler/ast/ClassDeclaration.cpp
compiler/ast/ClassDeclaration.h
compiler/ast/ClassInstance.cpp
compiler/ast/ClassInstance.h
compiler/ast/ClassParameterDeclaration.cpp
compiler/ast/ClassParameterDeclaration.h
compiler/ast/ClassParameterList.cpp
compiler/ast/ClassParameterList.h
compiler/ast/ConditionalOperator.cpp
compiler/ast/ConditionalOperator.h
compiler/ast/ConstantPredicateLoop.cpp
compiler/ast/ConstantPredicateLoop.h
compiler/ast/ConstDeclaration.cpp
compiler/ast/ConstDeclaration.h
compiler/ast/CstyleForLoop.cpp
compiler/ast/CstyleForLoop.h
compiler/ast/DebugStatementMarker.cpp
compiler/ast/DebugStatementMarker.h
compiler/ast/DictionaryEntry.cpp
compiler/ast/DictionaryEntry.h
compiler/ast/DictionaryInitializer.cpp
compiler/ast/DictionaryInitializer.h
compiler/ast/DoWhileLoop.cpp
compiler/ast/DoWhileLoop.h
compiler/ast/ElementAccess.cpp
compiler/ast/ElementAccess.h
compiler/ast/ElementAssignment.cpp
compiler/ast/ElementAssignment.h
compiler/ast/ElementIndexes.cpp
compiler/ast/ElementIndexes.h
compiler/ast/ElvisOperator.cpp
compiler/ast/ElvisOperator.h
compiler/ast/EmptyStatement.cpp
compiler/ast/EmptyStatement.h
compiler/ast/EnumDeclaration.cpp
compiler/ast/EnumDeclaration.h
compiler/ast/ErrorInitializer.cpp
compiler/ast/ErrorInitializer.h
compiler/ast/ExitStatement.cpp
compiler/ast/ExitStatement.h
compiler/ast/Expression.cpp
compiler/ast/Expression.h
compiler/ast/FloatValue.cpp
compiler/ast/FloatValue.h
compiler/ast/ForeachLoop.cpp
compiler/ast/ForeachLoop.h
compiler/ast/FormatExpression.h
compiler/ast/FormatExpression.cpp
compiler/ast/Function.cpp
compiler/ast/Function.h
compiler/ast/FunctionBody.cpp
compiler/ast/FunctionBody.h
compiler/ast/FunctionCall.cpp
compiler/ast/FunctionCall.h
compiler/ast/FunctionExpression.cpp
compiler/ast/FunctionExpression.h
compiler/ast/FunctionParameterDeclaration.cpp
compiler/ast/FunctionParameterDeclaration.h
compiler/ast/FunctionParameterList.cpp
compiler/ast/FunctionParameterList.h
compiler/ast/FunctionReference.cpp
compiler/ast/FunctionReference.h
compiler/ast/Identifier.cpp
compiler/ast/Identifier.h
compiler/ast/IfThenElseStatement.cpp
compiler/ast/IfThenElseStatement.h
compiler/ast/IndexBinding.cpp
compiler/ast/IndexBinding.h
compiler/ast/IntegerValue.cpp
compiler/ast/IntegerValue.h
compiler/ast/InterpolateString.cpp
compiler/ast/InterpolateString.h
compiler/ast/JumpStatement.cpp
compiler/ast/JumpStatement.h
compiler/ast/LabelableStatement.cpp
compiler/ast/LabelableStatement.h
compiler/ast/LoopStatement.cpp
compiler/ast/LoopStatement.h
compiler/ast/MemberAccess.cpp
compiler/ast/MemberAccess.h
compiler/ast/MemberAssignment.cpp
compiler/ast/MemberAssignment.h
compiler/ast/MemberAssignmentByOperator.cpp
compiler/ast/MemberAssignmentByOperator.h
compiler/ast/MethodCall.cpp
compiler/ast/MethodCall.h
compiler/ast/MethodCallArgumentList.cpp
compiler/ast/MethodCallArgumentList.h
compiler/ast/ModuleFunctionDeclaration.cpp
compiler/ast/ModuleFunctionDeclaration.h
compiler/ast/Node.cpp
compiler/ast/Node.h
compiler/ast/NodeVisitor.cpp
compiler/ast/NodeVisitor.h
compiler/ast/Program.cpp
compiler/ast/Program.h
compiler/ast/ProgramParameterDeclaration.cpp
compiler/ast/ProgramParameterDeclaration.h
compiler/ast/ProgramParameterList.cpp
compiler/ast/ProgramParameterList.h
compiler/ast/RegularExpressionValue.cpp
compiler/ast/RegularExpressionValue.h
compiler/ast/RepeatUntilLoop.cpp
compiler/ast/RepeatUntilLoop.h
compiler/ast/ReturnStatement.cpp
compiler/ast/ReturnStatement.h
compiler/ast/SequenceBinding.cpp
compiler/ast/SequenceBinding.h
compiler/ast/SpreadElement.cpp
compiler/ast/SpreadElement.h
compiler/ast/Statement.cpp
compiler/ast/Statement.h
compiler/ast/StringValue.cpp
compiler/ast/StringValue.h
compiler/ast/StructInitializer.cpp
compiler/ast/StructInitializer.h
compiler/ast/StructMemberInitializer.cpp
compiler/ast/StructMemberInitializer.h
compiler/ast/GeneratedFunction.cpp
compiler/ast/GeneratedFunction.h
compiler/ast/TopLevelStatements.cpp
compiler/ast/TopLevelStatements.h
compiler/ast/UnaryOperator.cpp
compiler/ast/UnaryOperator.h
compiler/ast/UninitializedFunctionDeclaration.cpp
compiler/ast/UninitializedFunctionDeclaration.h
compiler/ast/UninitializedValue.cpp
compiler/ast/UninitializedValue.h
compiler/ast/UserFunction.cpp
compiler/ast/UserFunction.h
compiler/ast/Value.cpp
compiler/ast/Value.h
compiler/ast/ValueConsumer.cpp
compiler/ast/ValueConsumer.h
compiler/ast/VariableAssignmentStatement.cpp
compiler/ast/VariableAssignmentStatement.h
compiler/ast/VariableBinding.cpp
compiler/ast/VariableBinding.h
compiler/ast/VarStatement.cpp
compiler/ast/VarStatement.h
compiler/ast/WhileLoop.cpp
compiler/ast/WhileLoop.h
compiler/astbuilder/AvailableParseTree.cpp
compiler/astbuilder/AvailableParseTree.h
compiler/astbuilder/BuilderWorkspace.cpp
compiler/astbuilder/BuilderWorkspace.h
compiler/astbuilder/CompilerWorkspaceBuilder.cpp
compiler/astbuilder/CompilerWorkspaceBuilder.h
compiler/astbuilder/CompoundStatementBuilder.cpp
compiler/astbuilder/CompoundStatementBuilder.h
compiler/astbuilder/ExpressionBuilder.cpp
compiler/astbuilder/ExpressionBuilder.h
compiler/astbuilder/FunctionResolver.cpp
compiler/astbuilder/FunctionResolver.h
compiler/astbuilder/GeneratedFunctionBuilder.cpp
compiler/astbuilder/GeneratedFunctionBuilder.h
compiler/astbuilder/ModuleDeclarationBuilder.cpp
compiler/astbuilder/ModuleDeclarationBuilder.h
compiler/astbuilder/ModuleProcessor.cpp
compiler/astbuilder/ModuleProcessor.h
compiler/astbuilder/ProgramBuilder.cpp
compiler/astbuilder/ProgramBuilder.h
compiler/astbuilder/SimpleStatementBuilder.cpp
compiler/astbuilder/SimpleStatementBuilder.h
compiler/astbuilder/SimpleValueCloner.cpp
compiler/astbuilder/SimpleValueCloner.h
compiler/astbuilder/SourceFileProcessor.cpp
compiler/astbuilder/SourceFileProcessor.h
compiler/astbuilder/TreeBuilder.cpp
compiler/astbuilder/TreeBuilder.h
compiler/astbuilder/UserFunctionBuilder.cpp
compiler/astbuilder/UserFunctionBuilder.h
compiler/astbuilder/UserFunctionVisitor.cpp
compiler/astbuilder/UserFunctionVisitor.h
compiler/astbuilder/ValueBuilder.cpp
compiler/astbuilder/ValueBuilder.h
compiler/codegen/AbstractSyntaxTreeStringGenerator.cpp
compiler/codegen/AbstractSyntaxTreeStringGenerator.h
compiler/codegen/CaseDispatchGroupVisitor.cpp
compiler/codegen/CaseDispatchGroupVisitor.h
compiler/codegen/ClassDeclarationRegistrar.cpp
compiler/codegen/ClassDeclarationRegistrar.h
compiler/codegen/CaseJumpDataBlock.cpp
compiler/codegen/CaseJumpDataBlock.h
compiler/codegen/CodeEmitter.cpp
compiler/codegen/CodeEmitter.h
compiler/codegen/CodeGenerator.cpp
compiler/codegen/CodeGenerator.h
compiler/codegen/DataEmitter.cpp
compiler/codegen/DataEmitter.h
compiler/codegen/DebugBlockGuard.cpp
compiler/codegen/DebugBlockGuard.h
compiler/codegen/FunctionReferenceRegistrar.cpp
compiler/codegen/FunctionReferenceRegistrar.h
compiler/codegen/InstructionEmitter.cpp
compiler/codegen/InstructionEmitter.h
compiler/codegen/InstructionGenerator.cpp
compiler/codegen/InstructionGenerator.h
compiler/codegen/ModuleDeclarationRegistrar.cpp
compiler/codegen/ModuleDeclarationRegistrar.h
compiler/file/ConformingCharStream.cpp
compiler/file/ConformingCharStream.h
compiler/file/ErrorListener.cpp
compiler/file/ErrorListener.h
compiler/file/PrettifyBuilder.cpp
compiler/file/PrettifyBuilder.h
compiler/file/PrettifyFileProcessor.cpp
compiler/file/PrettifyFileProcessor.h
compiler/file/PrettifyLineBuilder.cpp
compiler/file/PrettifyLineBuilder.h
compiler/file/SourceFile.cpp
compiler/file/SourceFile.h
compiler/file/SourceFileCache.cpp
compiler/file/SourceFileCache.h
compiler/file/SourceFileIdentifier.cpp
compiler/file/SourceFileIdentifier.h
compiler/file/SourceLocation.cpp
compiler/file/SourceLocation.h
compiler/format/CompiledScriptSerializer.cpp
compiler/format/CompiledScriptSerializer.h
compiler/format/DebugStoreSerializer.cpp
compiler/format/DebugStoreSerializer.h
compiler/format/ListingWriter.cpp
compiler/format/ListingWriter.h
compiler/format/StoredTokenDecoder.cpp
compiler/format/StoredTokenDecoder.h
compiler/model/ClassLink.cpp
compiler/model/ClassLink.h
compiler/model/CompilerWorkspace.cpp
compiler/model/CompilerWorkspace.h
compiler/model/FlowControlLabel.cpp
compiler/model/FlowControlLabel.h
compiler/model/FunctionLink.cpp
compiler/model/FunctionLink.h
compiler/model/LocalVariableScopeInfo.h
compiler/model/ScopableName.cpp
compiler/model/ScopableName.h
compiler/model/ScopeName.cpp
compiler/model/ScopeName.h
compiler/model/SimpleTypes.h
compiler/model/UserFunctionInclusion.h
compiler/model/UserFunctionType.h
compiler/model/Variable.cpp
compiler/model/Variable.h
compiler/model/VariableScope.h
compiler/model/WarnOn.h
compiler/optimizer/BinaryOperatorOptimizer.cpp
compiler/optimizer/BinaryOperatorOptimizer.h
compiler/optimizer/BinaryOperatorShortCircuitOptimizer.cpp
compiler/optimizer/BinaryOperatorShortCircuitOptimizer.h
compiler/optimizer/BinaryOperatorWithBooleanOptimizer.cpp
compiler/optimizer/BinaryOperatorWithBooleanOptimizer.h
compiler/optimizer/BinaryOperatorWithFloatOptimizer.cpp
compiler/optimizer/BinaryOperatorWithFloatOptimizer.h
compiler/optimizer/BinaryOperatorWithIntegerOptimizer.cpp
compiler/optimizer/BinaryOperatorWithIntegerOptimizer.h
compiler/optimizer/BinaryOperatorWithStringOptimizer.cpp
compiler/optimizer/BinaryOperatorWithStringOptimizer.h
compiler/optimizer/ConstantValidator.cpp
compiler/optimizer/ConstantValidator.h
compiler/optimizer/Optimizer.cpp
compiler/optimizer/Optimizer.h
compiler/optimizer/ReferencedFunctionGatherer.cpp
compiler/optimizer/ReferencedFunctionGatherer.h
compiler/optimizer/ShortCircuitCombiner.cpp
compiler/optimizer/ShortCircuitCombiner.h
compiler/optimizer/UnaryOperatorOptimizer.cpp
compiler/optimizer/UnaryOperatorOptimizer.h
compiler/optimizer/ValueConsumerOptimizer.cpp
compiler/optimizer/ValueConsumerOptimizer.h
compiler/representation/ClassDescriptor.cpp
compiler/representation/ClassDescriptor.h
compiler/representation/CompiledScript.cpp
compiler/representation/CompiledScript.h
compiler/representation/ConstructorDescriptor.cpp
compiler/representation/ConstructorDescriptor.h
compiler/representation/DebugBlock.cpp
compiler/representation/DebugBlock.h
compiler/representation/DebugStore.cpp
compiler/representation/DebugStore.h
compiler/representation/ExportedFunction.cpp
compiler/representation/ExportedFunction.h
compiler/representation/FunctionReferenceDescriptor.cpp
compiler/representation/FunctionReferenceDescriptor.h
compiler/representation/MethodDescriptor.cpp
compiler/representation/MethodDescriptor.h
compiler/representation/ModuleDescriptor.cpp
compiler/representation/ModuleDescriptor.h
compiler/representation/ModuleFunctionDescriptor.cpp
compiler/representation/ModuleFunctionDescriptor.h
compiler/Profile.h
compiler/Report.cpp
compiler/Report.h
bclassinstance.cpp
bclassinstance.h
berror.cpp
berror.h
blong.cpp
bobject.h
bstruct.cpp
bstruct.h
compilercfg.cpp
compilercfg.h
config.h
continueimp.cpp
continueimp.h
contiter.h
dbl.cpp
dict.cpp
dict.h
eprog.cpp
eprog.h
eprog_read.cpp
escript_config.cpp
escriptv.cpp
escriptv.h
escrutil.cpp
escrutil.h
execmodl.cpp
execmodl.h
exectype.h
executor.cpp
executor.h
executor.inl.h
executortype.h
filefmt.h
fmodule.cpp
fmodule.h
impstr.h
modules.h
objaccess.cpp
object.cpp
object.h
objmembers.h
objmethods.h
objstrm.cpp
regexp.cpp
regexp.h
str.cpp
str.h
symcont.cpp
symcont.h
tkn_strm.cpp
token.cpp
token.h
tokens.cpp
tokens.h
)