Skip to content

syntax: add support for raw strings - #709

Open
SuperFola wants to merge 3 commits into
devfrom
feat/raw-strings
Open

syntax: add support for raw strings#709
SuperFola wants to merge 3 commits into
devfrom
feat/raw-strings

Conversation

@SuperFola

@SuperFola SuperFola commented Aug 27, 2026

Copy link
Copy Markdown
Member

Description

Add support for raw strings so that writing regexes is easier: r"...".

The new re module is also included as a draft one, until it is entirely documented, tested, and properly reviewed.

To make using dict easier, @ can now operate on dict now, and behave the same as dict:get. I'll see about adding support for @= too.

Checklist

  • I confirm that I am the author of this code and release it to the ArkScript project under the MPL-2.0 licence. This contribution does not contain code from other sources, including code generated by a Large Language Model ("AI").
  • CHANGELOG.md is updated for new features, bug fixes or other significant changes
  • I have read the Contributor guide

Guidelines and best practices

  • Title of pull request is clear and informative
  • There are a small number of commits, each with an informative message, without any merge commit
  • Code is formatted to follow the style guidelines
  • Code is commented, particularly in hard-to-understand areas
  • Documentation has been updated, if needed (on https://github.com/ArkScript-lang/website, content/docs/)

Tests

  • I have added tests that prove my fix/feature is working
  • New and existing tests pass locally with my changes

@github-actions

Copy link
Copy Markdown

Static analysis report

Lizard report

Listing only functions with cyclomatic complexity >= 15 or NLOC >= 100 or parameters >= 6.

Filename Start line:end line Function name Parameters NLOC CCN
src/arkreactor/Compiler/AST/Parser.cpp 841:981 Ark::internal::Parser::string 1 136 47
src/arkreactor/Compiler/AST/Node.cpp 189:295 Ark::internal::Node::repr 0 90 31
src/arkreactor/Compiler/AST/Node.cpp 297:381 Ark::internal::Node::debugPrint 1 73 27
src/arkreactor/Compiler/AST/Parser.cpp 289:417 Ark::internal::Parser::import_ 1 98 23
src/arkscript/Formatter.cpp 212:274 Formatter::format 3 59 19
src/arkscript/Formatter.cpp 527:585 Formatter::formatCall 2 50 18
src/arkscript/Formatter.cpp 324:366 Formatter::formatFunction 2 36 16
Report about files you didn't modify in this PR
Filename Start line:end line Function name Parameters NLOC CCN
src/arkreactor/VM/VM.cpp 458:2055 Ark::VM::unsafeRun 2 1322 167
src/arkreactor/Compiler/Macros/Processor.cpp 259:643 Ark::internal::MacroProcessor::evaluate 3 353 119
src/arkreactor/Compiler/BytecodeReader.cpp 385:596 Ark::BytecodeReader::display 4 171 92
src/arkscript/main.cpp 24:391 main 2 317 45
src/arkreactor/Error/Diagnostics.cpp 45:192 Ark::Diagnostics::makeContext 4 109 44
src/arkscript/JsonCompiler.cpp 27:276 JsonCompiler::_compile 1 214 38
src/arkreactor/Compiler/NameResolution/NameResolutionPass.cpp 163:268 Ark::internal::NameResolutionPass::visitKeyword 3 85 35
src/arkreactor/Builtins/Slice.cpp 21:93 Ark::internal::Builtins::slice 1 63 34
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp 361:440 Ark::internal::ASTLowerer::compileListInstruction 3 64 32
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp 212:322 Ark::internal::ASTLowerer::compileExpression 5 92 31
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp 890:1038 Ark::internal::ASTLowerer::handleFunctionCall 3 116 31
src/arkreactor/Compiler/Macros/Processor.cpp 107:191 Ark::internal::MacroProcessor::processNode 3 63 28
src/arkreactor/Compiler/BytecodeReader.cpp 612:713 Ark::BytecodeReader::printInstruction 7 98 25
src/arkreactor/TypeChecker.cpp 149:236 Ark::types::generateError 6 75 25
src/arkreactor/Compiler/NameResolution/StaticScope.cpp 70:124 Ark::internal::NamespaceScope::get 3 42 24
src/arkreactor/TypeChecker.cpp 32:147 Ark::types::displayContract 6 102 24
src/arkreactor/Compiler/NameResolution/NameResolutionPass.cpp 57:161 Ark::internal::NameResolutionPass::visit 2 83 23
include/utf8.hpp 138:184 utf8::isValid 1 44 21
src/arkreactor/VM/Value/Value.cpp 81:149 Ark::Value::toString 2 54 21
src/arkreactor/Compiler/IntermediateRepresentation/IRInliner.cpp 258:330 Ark::internal::IRInliner::extractPagesMetadata 1 63 21
src/arkreactor/VM/VM.cpp 2209:2303 Ark::VM::backtrace 3 81 20
src/arkreactor/Compiler/AST/Optimizer.cpp 35:85 Ark::internal::Optimizer::countAndPruneDeadCode 1 42 20
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp 520:613 Ark::internal::ASTLowerer::compileFunction 3 67 19
src/arkreactor/Compiler/IntermediateRepresentation/IRInliner.cpp 128:189 Ark::internal::IRInliner::isBuiltinProxy 1 48 19
src/arkreactor/Builtins/String.cpp 47:113 fmt::formatter::parse 1 59 18
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp 837:888 Ark::internal::ASTLowerer::handleOperator 3 42 18
src/arkreactor/Compiler/AST/Optimizer.cpp 87:144 Ark::internal::Optimizer::pruneUnusedGlobalVariables 1 50 18
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp 107:129 Ark::internal::ASTLowerer::nodeProducesOutput 1 18 17
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp 635:683 Ark::internal::ASTLowerer::compileLetMutSet 4 40 17
src/arkreactor/Compiler/Macros/Executors/Function.cpp 16:89 Ark::internal::FunctionExecutor::applyMacro 2 56 17
include/Ark/Compiler/AST/Predicates.hpp 142:166 Ark::internal::IsSymbol::operator ( ) 1 24 16
src/arkreactor/VM/VM.cpp 2067:2124 Ark::VM::throwArityError 4 47 15
src/arkreactor/Compiler/Macros/Executors/Function.cpp 99:156 Ark::internal::FunctionExecutor::unify 5 50 15
src/arkreactor/Compiler/IntermediateRepresentation/IROptimizer.cpp 22:259 Ark::internal::IROptimizer::IROptimizer 1 215 12
src/arkreactor/Builtins/Time.cpp 72:92 Ark::internal::Builtins::Time::makeTimestamp 6 20 5
src/arkreactor/Error/Diagnostics.cpp 194:211 Ark::Diagnostics::helper 7 17 2

CppCheck report

Report files about files you didn't modify in this PR
Filename Line Type Description
src/arkreactor/Builtins/Bytecode.cpp 23 style Parameter 'vm' can be declared as pointer to const
src/arkreactor/Builtins/Time.cpp 32 style Parameter 'n' can be declared as reference to const
src/arkreactor/Compiler/BytecodeReader.cpp 20 performance Variable 'm_arg_kinds' is assigned in constructor body. Consider performing initialization in initialization list.
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp 658 style Consider using std::count_if algorithm instead of a raw loop.
src/arkreactor/Compiler/Lowerer/LocalsLocator.cpp 26 style The scope of the variable 'data' can be reduced.
src/arkreactor/Compiler/NameResolution/ScopeResolver.cpp 136 style Consider using std::find_if algorithm instead of a raw loop.
src/arkreactor/State.cpp 183 style Variable 'bytecode_hash' is assigned a value that is never used.
src/arkreactor/VM/SharedLibrary.cpp 0 information Too many #ifdef configurations - cppcheck only checks 12 of 13 configurations. Use --force to check all configurations.
src/arkreactor/VM/VM.cpp 0 information Too many #ifdef configurations - cppcheck only checks 12 of 13 configurations. Use --force to check all configurations.
include/Ark/VM/Value/Future.hpp 50 style Unused private function: 'Future::deleteSelfViaVM'
src/arkreactor/VM/Value/Future.cpp 23 performance Variable 'm_value' is assigned in constructor body. Consider performing initialization in initialization list.

@github-actions

Copy link
Copy Markdown

Super Instructions report

Some Super Instructions are under the usage threshold (24).

Super Instruction Uses in compiled code
APPEND_IN_PLACE_SYM_INDEX 23
INCREMENT 23
DECREMENT 15
STORE_FROM 9
LT_CONST_JUMP_IF_FALSE 8
NEQ_SYM_JUMP_IF_FALSE 4
CHECK_TYPE_OF 4
SET_VAL_TAIL 4
STORE_HEAD 2
NEQ_CONST_JUMP_IF_TRUE 2
SET_VAL_TAIL_BY_INDEX 1
SET_VAL_HEAD_BY_INDEX 1
MUL_SET_VAL 1
SET_VAL_HEAD 1
STORE_TAIL 1
Super Instructions over the threshold
Super Instruction Uses in compiled code
LOAD_CONST_LOAD_CONST 5966
CALL_SYMBOL 5486
LOAD_CONST_STORE 3236
CALL_BUILTIN_WITHOUT_RETURN_ADDRESS 1603
CALL_BUILTIN 983
LOAD_CONST_SET_VAL 978
INCREMENT_STORE 622
AT_SYM_SYM 584
GET_FIELD_FROM_SYMBOL_INDEX 512
STORE_LIST 388
GET_FIELD_FROM_SYMBOL 350
APPEND_IN_PLACE_SYM 345
LT_LEN_SYM_JUMP_IF_FALSE 339
CALL_SYMBOL_BY_INDEX 274
EQ_SYM_INDEX_JUMP_IF_TRUE 223
SET_VAL_FROM_INDEX 167
FUSED_MATH 145
SET_VAL_FROM 136
STORE_FROM_INDEX 130
LT_SYM_JUMP_IF_FALSE 125
DECREMENT_STORE 123
DECREMENT_BY_INDEX 117
STORE_LEN 117
GT_CONST_JUMP_IF_FALSE 115
LT_CONST_JUMP_IF_TRUE 98
GT_CONST_JUMP_IF_TRUE 91
AT_SYM_INDEX_SYM_INDEX 83
MUL_BY_INDEX 82
CALL_CURRENT_PAGE 77
EQ_CONST_JUMP_IF_TRUE 53
AT_SYM_INDEX_CONST 53
MUL_BY 47
GT_SYM_JUMP_IF_FALSE 40
STORE_HEAD_BY_INDEX 37
STORE_TAIL_BY_INDEX 36
INCREMENT_BY_INDEX 35
CHECK_TYPE_OF_BY_INDEX 30

@coveralls

coveralls commented Aug 27, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 33080303420

Coverage increased (+0.01%) to 94.39%

Details

  • Coverage increased (+0.01%) from the base build.
  • Patch coverage: 4 uncovered changes across 1 file (77 of 81 lines covered, 95.06%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
src/arkreactor/Compiler/AST/Node.cpp 36 32 88.89%
Total (5 files) 81 77 95.06%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 11354
Covered Lines: 10717
Line Coverage: 94.39%
Coverage Strength: 1176230.75 hits per line

💛 - Coveralls

@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown

Fuzzing report

/usr/local/bin/afl-whatsup status check tool for afl-fuzz by Michal Zalewski

Summary stats

    Fuzzers alive : 0
   Dead or remote : 1 (included in stats)
   Total run time : 5 minutes, 0 seconds
      Total execs : 44 thousands
 Cumulative speed : 148 execs/sec
    Pending items : 157 faves, 1279 total
 Coverage reached : 10.64%
    Crashes saved : 0
      Hangs saved : 0

Cycles without finds : 0
Time without finds : 0

[+] Captured 46421 tuples (map size 279154, highest value 255, total values 466282944) in '/dev/null'.
[+] A coverage of 46421 edges were achieved out of 279168 existing (16.63%) with 1290 input files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants