- When adding or removing tests in
specs/src/test/ProcessingTest.cc, also updatecount_processing_testsinspecs/tests/valgrind_unit_tests.py. - When adding or removing tests in
specs/src/test/ALUUnitTest.cc, also updatecount_ALU_testsinspecs/tests/valgrind_unit_tests.py. - When adding or removing tests in
specs/src/test/TokenTest.cc, also updatecount_token_testsinspecs/tests/valgrind_unit_tests.py. - Keep any new
ProcessingTest.ccregression cases appended at the end when possible, to avoid unnecessary renumbering. MYASSERT(cond)andMYASSERT_WITH_MSG(cond, msg)(defined inspecs/src/utils/ErrorReporting.h) are always-on runtime checks that throwSpecsExceptionviaMYTHROW. They are not compiled out byNDEBUG. Do not add redundantif/MYTHROWguards that duplicate what aMYASSERTalready covers.- When building the project, always use the command-line
make clean all. Do not skip thecleantarget, and do not use the-jargument. - When changing the structure of any of the classes that have dump_ macros in
specs_gdb.pyandspecs.gdbupdate the relevant macros as well.
The CONTEXT keyword requires special handling during token normalization (normalizeTokenList in tokens.cc):
-
Initial State: When a CONTEXT token is first parsed, its
Literal()field is empty. -
Normalization Process (lines 920-951 in tokens.cc):
- Check if the next token exists:
i+1 < tokList->size() - If yes, extract the integer offset from the next token (which can be a RANGE or a literal)
- Store the offset string in the CONTEXT token's literal field
- Erase the next token from the list
- If no next token exists, the literal remains empty
- Check if the next token exists:
-
Compile-Time Validation (lines 473-489 in specItems.cc):
- When
itemGroup::Compileprocesses a CONTEXT token, it must validate that the literal is not empty - Use
tokenVec[index].argIndex()(not the vector index) for error messages - Call
std::stoi(tokenVec[index].Literal())only after validation
- When
The if statement at line 923 in tokens.cc checks tok.Literal()=="" because:
- If there is no next token (
i+1 >= tokList->size()), the condition is false - The literal is never set
- The error is caught at compile time in specItems.cc with a proper error message
Example that triggers the error:
specs '1-* 1 CONTEXT'
This produces: "CONTEXT at index X must be followed by an integer offset"
All rolling context tests are in specs/src/test/ProcessingTest.cc (tests #229-#241).
Run with: ../exe/ProcessingTest
When rolling context is used and verbose mode is enabled (-v flag), the buffer sizes are printed:
Rolling context buffer sizes: forward=<n> backward=<m>
This is implemented in specs/src/test/specs.cc after the compilation phase.