Skip to content

Commit

Permalink
Merge pull request #164 from nlmixr2/161-lincmt-issues
Browse files Browse the repository at this point in the history
Add test case and grammar change for commas in advan/trans
  • Loading branch information
mattfidler authored Sep 25, 2023
2 parents f9c6be3 + 94983da commit c1b9a64
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions inst/sub.g
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//loop
statement_list : (statement)+ ;

statement: advan_statement
statement: advan_statement
| trans_statement
| tol_statement
| atol_statement
Expand Down Expand Up @@ -47,7 +47,7 @@ sstol_statement2: sstol_keyword '=' nonSpace;
sstol_statement: sstol_statement1 | sstol_statement2 | sstol_statement3;

unsupported_subnames: 'SS' | 'PK' | 'ERROR' | 'DES' | 'AES' | 'INFN' | 'MODEL'
'ss' | 'pk' | 'error' | 'des' | 'aes' | 'infn' | 'model' |
'ss' | 'pk' | 'error' | 'des' | 'aes' | 'infn' | 'model' |
'Ss' | 'Pk' | 'Error' | 'Des' | 'Aes' | 'Infn' | 'Model';

unsupported_statement: unsupported_subnames '=' nonSpace;
Expand All @@ -56,7 +56,7 @@ decimalint: "0|([1-9][0-9]*)" $term -1;
string: "\"([^\"\\]|\\[^])*\"";
float1: "([0-9]+.[0-9]*|[0-9]*.[0-9]+)([eE][\-\+]?[0-9]+)?" $term -2;
float2: "[0-9]+[eE][\-\+]?[0-9]+" $term -3;
whitespace: ( "[ \t\r\n]+" | singleLineComment )*;
whitespace: ( "[ \t\r\n, ]+" | singleLineComment )*;
singleLineComment: ';' "[^\n]*";
nonSpace: "[^0-9 \n][^ \n]*";
identifier_nm: "[a-zA-Z][a-zA-Z0-9_]*" $term -4;
6 changes: 3 additions & 3 deletions src/sub.g.d_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -1022,14 +1022,14 @@ d_accepts_diff_82_0_nonmem2rxSub
unsigned char d_scanner_82_0_0_nonmem2rxSub[SCANNER_BLOCK_SIZE] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0,
};

unsigned char d_scanner_82_1_0_nonmem2rxSub[SCANNER_BLOCK_SIZE] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};

Expand Down Expand Up @@ -2526,7 +2526,7 @@ D_Symbol d_symbols_nonmem2rxSub[] = {
{D_SYMBOL_REGEX, "\\\"([^\\\"\\\\\\\\]|\\\\\\\\[^])*\\\"", 38, -1},
{D_SYMBOL_REGEX, "([0-9]+.[0-9]*|[0-9]*.[0-9]+)([eE][\\\\-\\\\+]?[0-9]+)?", 55, -1},
{D_SYMBOL_REGEX, "[0-9]+[eE][\\\\-\\\\+]?[0-9]+", 29, -1},
{D_SYMBOL_REGEX, "[ \\t\\r\\n]+", 13, -1},
{D_SYMBOL_REGEX, "[ \\t\\r\\n, ]+", 15, -1},
{D_SYMBOL_STRING, ";", 1, -1},
{D_SYMBOL_REGEX, "[^\\n]*", 7, -1},
{D_SYMBOL_REGEX, "[^0-9 \\n][^ \\n]*", 18, -1},
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-sub.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ test_that("test sub", {

expect_error(.s("tranvan1"))

.s("ADVAN1,TRANS2", c(advan=1L, trans=2L, abbrevLin=1L))
.s("ADVAN1 TRANS1", c(advan=1L, trans=1L, abbrevLin=1L))
.s("ADVAN1 TRANS2", c(advan=1L, trans=2L, abbrevLin=1L))
.s("ADVAN=ADVAN1 TRANS=TRANS2", c(advan=1L, trans=2L, abbrevLin=1L))
Expand Down

0 comments on commit c1b9a64

Please sign in to comment.