Skip to content

Commit

Permalink
Issue #269 - Support the RECNO token (#270)
Browse files Browse the repository at this point in the history
* Issue #269 - Support the RECNO token

* Issue #269 - update the help to include this
  • Loading branch information
yoavnir authored Nov 23, 2024
1 parent 08265e6 commit 9ef3c86
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions manpage
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ A range of fields, such as `fields 5` or `f5-7`, where fields are separated by e
begun, while DTODclock gives the time of producing the current record.
.P
.B NUMBER
or
.B RECNO
-- A record counter as a 10-digit decimal number.
.P
.B TIMEDIFF
Expand Down
2 changes: 1 addition & 1 deletion specs/docs/basicspec.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ The **InputSource** argument may be any of the following:
* A range of fields, such as `fields 5` or `f5-7`, where fields are separated by exactly one `fieldseparator` character -- a tab by default. The field indexing is 1-based. Negative indexes can be used here as well.
* **TODclock** - a floating point number, accurate to microseconds and giving seconds since the Unix epoch.
* **DTODclock** - a floating point number, accurate to microseconds and giving seconds since the Unix epoch. The difference is that TODclock shows the time when this run of *specs* begun, while DTODclock gives the time of producing the current record.
* **NUMBER** - A record counter as a 10-digit decimal number. Read more about expressions on the [Arithmetic-Logical Unit](alu.md) page.
* **NUMBER** or **RECNO** - A record counter as a 10-digit decimal number. Read more about expressions on the [Arithmetic-Logical Unit](alu.md) page.
* **TIMEDIFF** - a 12-char decimal number indicating the number of microseconds since the invocation of the program.
* An **ID** keyword followed by a previously defined **FieldIdentifier**.
* The **PRINT** keyword followed by a calculated expression. The keyword **PRINT** can be replaced by a question mark, either as a standalone token as in `specs ? "2+2"` or as a prefix to the expression, as in `specs "?2+2"`. It should be noted that the former does not work in a shell environment such as *zsh* or *tcsh*, where a question mark is a wildcard for a single character, but it does work for *bash*.
Expand Down
3 changes: 1 addition & 2 deletions specs/docs/onepage.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@ The **InputPart** argument may be any of the following:
* A range of fields, such as `fields 5` or `f5-7`, where fields are separated by exactly one `fieldseparator` character -- a tab by default. The field indexing is 1-based.
* **TODclock** - a 64-bit formatted timestamp, giving microseconds since the Unix epoch.
* **DTODclock** - a 64-bit formatted timestamp, giving microseconds since the Unix epoch. The difference is that TODclock shows the time when this run of *specs* begun, while DTODclock gives the time of producing the current record.
* **NUMBER** - A record counter as a 10-digit decimal number.
* **NUMBER** or **RECNO** - A record counter as a 10-digit decimal number.
* **TIMEDIFF** - a 12-char decimal number indicating the number of microseconds since the invocation of the program.
* An **ID** keyword followed by a previously defined **FieldIdentifier**.
* The **NUMBER** keyword used as a counter for processed records.
* The **PRINT** keyword followed by a calculated expression
* A string literal, optionally enclosed by delimiters, such as `/TODclock/` or `'NUMBER'`. Note that to include the single quotes on the command line requires you to enclose them in double quotes.
* A **SUBSTring** of another InputPart.
Expand Down
1 change: 1 addition & 0 deletions specs/src/cli/tokens.cc
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ void parseSingleToken(std::vector<Token> *pVec, std::string arg, int argidx)
SIMPLETOKEN(center, CENTER);
SIMPLETOKEN(centre, CENTER);
SIMPLETOKEN(number, NUMBER);
SIMPLETOKEN(recno, NUMBER);
SIMPLETOKEN(read, READ);
SIMPLETOKEN(readstop, READSTOP);
SIMPLETOKEN(write, WRITE);
Expand Down
1 change: 1 addition & 0 deletions specs/src/test/TokenTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ int main(int argc, char** argv)
TESTNS("left center centre right lefta lef cent centrer", "LEFT|CENTER|CENTER|RIGHT|LITERAL; /lefta/|LITERAL; /lef/|LITERAL; /cent/|LITERAL; /centrer/");
TESTNS("C2B B2C X2CH C2X", "CONVERSION; /C2B/|CONVERSION; /B2C/|CONVERSION; /X2CH/|CONVERSION; /C2X/");
TESTNS("numBER NUMbe numBERa", "NUMBER|LITERAL; /NUMbe/|LITERAL; /numBERa/");
TESTNS("recNO RECno RecN ReCnOm", "NUMBER|NUMBER|LITERAL; /RecN/|LITERAL; /ReCnOm/");
TESTNS("reAd wrIte ReadStop", "READ|WRITE|READSTOP");
TESTNS("a: w1 . ID a 1", "RANGELABEL; /a/|WORDRANGE; S:1|PERIOD|ID; /a/|RANGE; S:1");
TESTNS("stop anyeof printonly eof w1 1", "STOP; /any/|PRINTONLY; /EOF/|WORDRANGE; S:1|RANGE; S:1");
Expand Down
2 changes: 1 addition & 1 deletion specs/tests/valgrind_unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

count_ALU_tests = 749
count_processing_tests = 186
count_token_tests = 16
count_token_tests = 17

# Parse the one command line options
parser = argparse.ArgumentParser()
Expand Down

0 comments on commit 9ef3c86

Please sign in to comment.