From 5107f51f1ba2b12dbffef31403ebfea30688b96b Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Wed, 29 May 2019 18:31:55 +1000 Subject: [PATCH] Remove excess blank lines We never need 2 blank lines in a row. Signed-off-by: NeilBrown --- csrc/indent_test.mdc | 1 - csrc/mdcode.mdc | 4 ---- csrc/oceani-tests.mdc | 3 --- csrc/oceani.mdc | 5 ----- csrc/parsergen.mdc | 6 ------ csrc/scanner-tests.mdc | 1 - csrc/scanner.mdc | 7 ------- 7 files changed, 27 deletions(-) diff --git a/csrc/indent_test.mdc b/csrc/indent_test.mdc index 699b3ca..55a0fe6 100644 --- a/csrc/indent_test.mdc +++ b/csrc/indent_test.mdc @@ -123,7 +123,6 @@ with complete bracketing and indenting. exit(0); } - # indent: grammar ~~~~~~ diff --git a/csrc/mdcode.mdc b/csrc/mdcode.mdc index e1498ce..2789671 100644 --- a/csrc/mdcode.mdc +++ b/csrc/mdcode.mdc @@ -119,7 +119,6 @@ will "do the right thing". libmdcode.o : libmdcode.c mdcode.h $(CC) $(CFLAGS) -c libmdcode.c - ### File: md2c.c #include @@ -577,7 +576,6 @@ end of the code, we don't need to check for these blank lines. return c; } - static char *take_code(char *pos, char *end, char *marker, struct psection **table, struct text section, int *line_nop) @@ -774,7 +772,6 @@ error message - a `code_err_fn`. struct section *code_extract(char *pos, char *end, code_err_fn error); - ## Using the library Now that we can extract code from a document and link it all together @@ -883,7 +880,6 @@ And now we take a single file name, extract the code, and if there are no error we write out a file for each appropriate code section. And we are done. - ##### client includes #include diff --git a/csrc/oceani-tests.mdc b/csrc/oceani-tests.mdc index 04b9458..d7253b3 100644 --- a/csrc/oceani-tests.mdc +++ b/csrc/oceani-tests.mdc @@ -98,7 +98,6 @@ calculations on them. ###### test list oceani_tests += "valvar" - ###### test: valvar program: @@ -797,7 +796,6 @@ various places that `type_err()` are called. .tmp.code:3:12: error: unhandled parse error: : oceani: no program found. - ## Test erroneous command line args To improve coverage, we want to test correct handling of strange command @@ -820,7 +818,6 @@ command list possible. ./coverage_oceani $${1+"$$@"} > /dev/null 2>&1 ;\ done || true - ###### test list oceani_special_tests += "cmd" oceani_special_tests += "cmd,-zyx" diff --git a/csrc/oceani.mdc b/csrc/oceani.mdc index a3eba94..342182e 100644 --- a/csrc/oceani.mdc +++ b/csrc/oceani.mdc @@ -1034,7 +1034,6 @@ Each variable records a scope depth and is in one of four states: in scope. It is permanently out of scope now and can be removed from the "in scope" stack. - ###### variable fields int depth, min_depth; enum { OutScope, PendingScope, CondScope, InScope } scope; @@ -1491,7 +1490,6 @@ in `val` or the pointer to a value in `lval`. If `lval` is set, but a simple value is required, `inter_exec()` will dereference `lval` to get the value. - ###### core functions struct lrval { @@ -2948,7 +2946,6 @@ precedence is handled better I might be able to discard this. rv.str = text_join(left.str, right.str); break; - ###### value functions static struct text text_join(struct text a, struct text b) @@ -3605,7 +3602,6 @@ defined. var_block_close(config2context(config), CloseElse); }$ - $*exec // These scopes are closed in CondSuffix ForPart -> for OpenScope SimpleStatements ${ @@ -4056,7 +4052,6 @@ analysis is a bit more interesting at this level. c->prog = $<1; } }$ - $*binode Program -> program OpenScope Varlist Block OptNL ${ $0 = new(binode); diff --git a/csrc/parsergen.mdc b/csrc/parsergen.mdc index a236f83..94c29df 100644 --- a/csrc/parsergen.mdc +++ b/csrc/parsergen.mdc @@ -21,7 +21,6 @@ There are several distinct sections. `parsergen` program built from the C code in this file can extract that grammar directly from this file and process it. - ###### File: parsergen.c #include #include @@ -839,7 +838,6 @@ array like the productions. return sl->ss; } - ### Setting `nullable` We set `nullable` on the head symbol for any production for which all @@ -890,7 +888,6 @@ If a symbol cannot derive a NEWLINE, then it is only part of a line - so is word-like. If it can derive a NEWLINE, then we consider it to be like a line. - Clearly the `TK_newline` token can derive a NEWLINE. Any symbol which is the head of a production that contains a line_like symbol is also a line-like symbol. We use a new field `line_like` to record this @@ -1659,7 +1656,6 @@ The LA sets which are (possibly) reported with each item: Then the go to sets: - static void report_goto(struct grammar *g, struct symset gt) { int i; @@ -1857,7 +1853,6 @@ include newlines as token. return cnt; } - ## Generating the parser The exported part of the parser is the `parse_XX` function, where the name @@ -1960,7 +1955,6 @@ The go to table is stored in a simple array of `sym` and corresponding short min_prefix; }; - ###### functions static void gen_goto(FILE *f, struct grammar *g) diff --git a/csrc/scanner-tests.mdc b/csrc/scanner-tests.mdc index 9756b08..3496f79 100644 --- a/csrc/scanner-tests.mdc +++ b/csrc/scanner-tests.mdc @@ -45,7 +45,6 @@ about each test. scanner.c libscanner.c \ libmdcode.o libnumber.o libstring.o -licuuc -lgmp - ## Basic tests Some simple tests... maybe all tests are simple. diff --git a/csrc/scanner.mdc b/csrc/scanner.mdc index 705e02e..42001ff 100644 --- a/csrc/scanner.mdc +++ b/csrc/scanner.mdc @@ -85,7 +85,6 @@ from token to token. ###### token_next init int ignored = state->conf->ignored; - The different tokens are numbers, words, marks, strings, comments, newlines, EOF, and indents, each of which is examined in detail below. @@ -805,7 +804,6 @@ information and return one token. continue; } - ###### delayed tokens if (state->check_indent || state->delayed_lines) { @@ -848,7 +846,6 @@ tokens will continue to return the same end-of-file token. ###### token types TK_eof, - ###### white space if (ch == WEOF) { if (state->col) { @@ -1093,7 +1090,6 @@ parsed too much already. For that there is `reset_token`. tok->txt.len = 0; } - Tokens make not cross into the next `code_node`, and some tokens can include the newline at the and of a `code_node`, we must be able to easily check if we have reached the end. Equally we need to know if @@ -1525,7 +1521,6 @@ character `expc`. tok.txt += d; tok.len -= d; - Now that we have the mantissa and the exponent we can multiply them together, also allowing for the number of digits after the decimal mark. @@ -1589,7 +1584,6 @@ Now we are ready to parse a number: the base, mantissa, and exponent. If all goes well we check for the possible trailing letters and return. Return value is 1 for success and 0 for failure. - ###### number functions int number_parse(mpq_t num, char tail[3], struct text tok) { @@ -1924,7 +1918,6 @@ String parsing goes in `libstring.c` libstring.o : libstring.c $(CC) $(CFLAGS) -c libstring.c - ## Testing As "untested code is buggy code" we need a program to easily test -- 2.43.0