Age | Commit message (Collapse) | Author | Files |
|
* .gitmodules: New module: wordsplit
* Makefile.am: Distribute wordsplit files.
* am/grecs.m4 (GRECS_INCLUDES): Add wordsplit directory
* doc/Makefile.am (dist_man_MANS): Distribute wordsplit/wordsplit.3
* doc/wordsplit.3: Remove.
* include/Makefile.am (GRECS_HDR): Add wordsplit/wordsplit.
* include/wordsplit.h: Remove.
* src/Make-inst.am: Define nodist_libgrecs_la_SOURCES.
* src/Make-shared.am: Likewise.
* src/Make-static.am: Define nodist_libgrecs_a_SOURCES.
* src/Make.am (GRECS_SRC): Remove wordsplit.c
(NODIST_GRECS_SRC): Define to wordsplit.c
(VPATH): Add the wordsplit directory.
* src/wordsplit.c: Remove.
* tests/wordsplit.at: Remove.
* tests/wsp.c: Remove.
* tests/Makefile.am: Build separate testsuite for wordsplit. Use VPATH
to build wsp.
* tests/.gitignore: Update.
|
|
|
|
This feature allows the user to limit the number of words returned
by a call to wordsplit. When the number of words in expansion reaches
the predefined limit, the rest of input line will be expanded and returned
as a single last word.
For example, to parse a /etc/passwd line:
struct wordsplit ws;
ws.ws_delim = ":";
ws.ws_maxwords = 7;
ws.ws_options = WRDSO_MAXWORDS;
wordsplit(str, &ws, WRDSF_NOVAR | WRDSF_NOCMD | WRDSF_DELIM | WRDSF_OPTIONS);
* doc/wordsplit.3: Document the maxwords feature.
* include/wordsplit.h (wordsplit) <ws_maxwords>
<ws_wordi>: New members.
(WRDSO_MAXWORDS): New option.
* src/wordsplit.c (WSP_RETURN_DELIMS): New macro.
(_wsplt_subsplit): Rewrite.
(wordsplit_init0): Don't reset node list.
(wordsplit_init): Initialize ws_wordi and the node list.
(wsnode_insert): Correctly insert lists.
(coalesce_segment): Additional safety check.
(wsnode_tail_coalesce): New static function.
(wordsplit_finish): Postprocess delimiters.
(expvar,expcmd): Use new _wsplt_subsplit.
(wordsplit_varexp): Don't try to expand delimiter nodes.
(skip_delim): Remove delimiter processing. It is now done
in wordsplit_finish.
(scan_word): New argument 'consume_all' instructs it to
consume the rest of input as one token.
(wordsplit_process_list): Handle wsp->ws_maxwords setting.
This also fixed a long-standing bug: quotes weren't processed
in WRDSF_NOSPLIT mode. See the testcase 59 (incremental nosplit).
(wordsplit_run): Rewrite.
(wordsplit_free): Free node list.
* tests/wordsplit.at: Update for the new wsp output format.
(incremental nosplit): Expect correct output.
Add tests for the maxwords feature.
* tests/wsp.c (maxwords): New flag.
Print the ws_wordi value as "TOTALS" at the end of each run.
|
|
* src/wordsplit.c (expvar): Gracefully handle NULL values in
ENV_KV environment.
* src/wordsplit.h: Fix typo in a comment.
* doc/wordsplit.3: Update.
|
|
The adjacent string concatenation feature doesn't work well with
multiple-argument statements. The common example (found in GNU
pies) is the "env" statement:
env "PATH=/sbin:$PATH" "PRELOAD=true"
The intent was to pass it two arguments, but in fact they get
concatenated into one.
To control this, the grecs_parser_options variable is introduced.
If it has the GRECS_OPTION_QUOTED_STRING_CONCAT bit set, adjacent
string concatenation is enabled. By default it is disabled.
The GRECS_OPTION_ADJUST_STRING_LOCATIONS bit controls the way the
quoted sring locations are computed. If it is set, the beginning of
the string is counted at the first character after the opening double
quote, and its end at the character immediately preceding the closing
double quote. Otherwise, both double-quote characters are included in
the location (the default).
The change is backward incompatible.
* doc/grecs-syntax.texi: Update.
* include/grecs/parser.h (grecs_adjust_string_locations): Remove.
(grecs_parser_options): New extern.
* src/grecs-lex.l: QSTRING is returned only if
GRECS_OPTION_QUOTED_STRING_CONCAT option is set.
The GRECS_OPTION_ADJUST_STRING_LOCATIONS option controls string locus
adjustment.
* src/parser.c (grecs_adjust_string_locations): Remove.
(grecs_parser_options): New variable.
* tests/Makefile.am: Add strcat.at, stradj.at
* tests/testsuite.at: Likewise.
* tests/gcffmt.c: New options -strcat and -stradj
* tests/stradj.at: New test case.
* tests/strcat.at: New test case.
|
|
|
|
|
|
|
|
|
|
* src/wordsplit.c (wordsplit_getwords): New functon.
* src/wordsplit.h (wordsplit_getwords): New proto.
* doc/wordsplit.3: Add example section, document wordsplit_getwords.
|
|
|
|
* src/wordsplit.c: Implement default assignment, word
expansion in variable defaults, distinction between
${variable:-word} and ${variable-word}.
* doc/wordsplit.3: New file.
* src/wordsplit.h (wordsplit)<ws_envbuf,ws_envidx>
<ws_envsiz>: New members.
(WRDSF_ARGV): Remove.
(WRDSF_OPTIONS): New flag.
(WRDSO_ARGV): New option bit.
* tests/wordsplit.at: Add new tests.
* tests/wsp.c: Set WRDSF_OPTIONS flag if one of the options is requested.
|
|
* doc/grecs-syntax.texi: Document changes to the #include statement.
* doc/grecs_config.5: Likewise.
* src/preproc.c (include_glob, include_pos)
(include_once): New statics.
(pp_list_find): Return 0 if list is NULL.
(incl_copy): New statics.
(source_lookup): Use incl_copy as the copy function.
(pop_source): If more glob expansions are available, push next one
onto input stack.
(isglob): New static.
(parse_include): Support globbing patterns.
* tests/Makefile.am: Add new testes.
* tests/testsuite.at: Likewise.
* tests/incl00.at: New test case.
* tests/incl01.at: New test case.
* tests/incl02.at: New test case.
* tests/incl03.at: New test case.
|
|
* am/grecs.m4 (parser-dhcpd): New option.
* doc/GRECS_SETUP.3: Document parser-dhcpd
* src/.gitignore: Add dhcpd-* generated files.
* src/Make.am [GRECS_COND_DHCPD_PARSER]: Define DHCPD variables.
(GRECS_SRC, EXTRA_DIST): Reference them.
* src/dhcpd-gram.y: New file.
* src/dhcpd-lex.l: New file.
* src/grecs.h (grecs_dhcpd_parser): New proto.
* src/tree.c (node_reduce): Fix return without a value.
|
|
* am/grecs.m4 (GRECS_SETUP): New option install-headers.
New subst variable GRECS_INCLUDE_DIR.
* doc/GRECS_SETUP.3: Document the install-headers option.
* src/Make-shared.am [GRECS_COND_INSTALLHEADERS]: Install
headers in GRECS_INCLUDE_DIR.
|
|
|
|
|
|
* Makefile.am (EXTRA_DIST): Add @GRECS_DISTDOC@.
* am/grecs.m4 (GRECS_SETUP): New flag syntax-doc sets
GRECS_DISTDOC.
* doc/GRECS_SETUP.3: Update.
* src/format.c (grecs_format_node): Print value if GRECS_NODE_FLAG_VALUE
is set.
* tests/glob01.at: Update.
|
|
* doc/grecs-syntax.texi: Remove the topmost @section to
let includers specify their own sectioning command.
|
|
* src/format.c (grecs_format_docstring): Rename to grecs_print_docstring.
(grecs_format_simple_statement): Rename to grecs_print_simple_statement.
(grecs_format_block_statement): Rename to grecs_print_block_statement.
(grecs_format_statement_array): Rename to grecs_print_statement_array.
(grecs_format_locus): Rename to grecs_print_locus.
(grecs_format_node_path): Rename to grecs_print_node_path.
(grecs_format_value): Rename to grecs_print_value.
(grecs_format_node): Rename to grecs_print_node.
(grecs_format_locus,grecs_format_node_path)
(grecs_format_value,grecs_format_node): Reimplement as
output-independent functions.
All uses changed.
* src/grecs.h: Update prototypes.
* doc/grecs_format_locus.3: Update.
* doc/grecs_format_node.3: Update.
* doc/grecs_format_node_path.3: Update.
* doc/grecs_format_value.3: Update.
|
|
* am/grecs.m4: New option: parser-git
* doc/GRECS_SETUP.3: Document new options.
* src/git-parser.c: New file.
* src/Make.am [GRECS_COND_GIT_PARSER]: Define GRECS_PARSER_GIT.
(GRECS_SRC): Add GRECS_PARSER_GIT.
* src/grecs.h (grecs_git_parser): New proto.
* src/txtacc.c (grecs_txtacc_free): Ignore NULL argument.
|
|
* Makefile.am (EXTRA_DIST): Add build-aux/yyrename
* am/grecs.m4: New options: parser-meta1 and all-parsers
* src/.gitignore: Update.
* src/Make.am [GRECS_COND_META1_PARSER]: Set GRECS_PARSER_META1 and
GRECS_EXTRA_META1
(GRECS_SRC): Add new files.
(EXTRA_DIST): Add GRECS_EXTRA_META1.
(LEXCOMPILE,YACCCOMPILE): Redefine
* src/grecs-gram.y: Don't include yygrecs.h
(grecs_vasprintf,grecs_asprintf): Move to a separate file.
(grecs_parse): Rename to grecs_grecs_parser.
Actual grecs_parse is defined in parser.c
(grecs_gram_trace): Move to parser.c
* src/grecs-lex.l: Don't include yygrecs.h
Use line_acc functions.
* src/grecs.h (grecs_trace_flags): New extern.
(GRECS_TRACE_GRAM, GRECS_TRACE_LEX): New flags.
(grecs_lex_begin): Change signature.
(grecs_grecs_parser,grecs_meta1_parser): New protos.
(grecs_line_acc_create)
(grecs_line_acc_free,grecs_line_acc_grow_char)
(grecs_line_acc_grow_char_unescape)
(grecs_line_acc_grow)
(grecs_line_acc_grow_unescape_last): New protos.
(GRECS_TXTACC_BUFSIZE): New const
(grecs_txtacc_create,grecs_txtacc_free)
(grecs_txtacc_grow,grecs_txtacc_finish)
(grecs_txtacc_free_string): New protos.
(grecs_value_match): New proto.
* src/wordsplit.c (quote_transtab): Translate \"
* src/yygrecs.h: Remove.
* src/yytrans: New file.
* build-aux/yyrename: New file.
* src/asprintf.c: New file.
* src/lineacc.c: New file.
* src/meta1-gram.y: New file.
* src/meta1-lex.l: New file.
* src/parser.c: New file.
* src/txtacc.c: New file.
* doc/grecs_parse.3: Update.
* doc/GRECS_SETUP.3: Update.
|
|
* .gitignore: Add gitid.h
* Makefile.am: Build gitid.h.
* am/grecs.m4: Remove GRECS_VEROK_AT.
* build-aux/getopt.m4 (print_version_hook): New variable.
(print_version): Call print_version_hook, if defined.
* src/Make.am (INCLUDES): Update.
* src/grecs.h (grecs_version_info) <id>: New member.
* src/version.c (grecs_version): Initialize id.
* tests/Makefile.am: Remove GRECS_VEROK_AT.
* tests/testsuite.at: Likewise.
|
|
* src/grecs.h (grecs_free_fun): New extern.
(grecs_free): New proto.
* src/format.c: Use grecs_free where appropriate.
* src/grecs-lex.l: Likewise.
* src/preproc.c: Likewise.
* src/tree.c: Likewise.
* src/lookup.c (parse_label): Use grecs_value_list_create.
* src/mem.c: Initialize hooks with the default values.
(grecs_free_fun): New hook.
(grecs_free): New function.
* doc/grecs_malloc.3: Document grecs_free.
* doc/grecs_parse.3: Document the recent changes.
* doc/grecs_strdup.3: Update.
|
|
* am/grecs.m4 (GRECS_SETUP): New option: shared.
* doc/GRECS_SETUP.3: Document new options.
* doc/grecs_format_locus.3: Update.
* doc/grecs_format_node.3: Document new flags.
* src/.gitignore: Update.
* src/version.c: New file.
* src/Make.am (GRECS_SRC): Add version.c
(EXTRA_DIST): Update.
* src/diag.c (default_print_diag): Flush stdout as per the docs.
* src/format.c (grecs_format_locus): Don't print trailing semicolon.
(grecs_format_value): Handle GRECS_NODE_FLAG_NOQUOTE flag.
(grecs_format_node): Print delimiters when needed.
* src/grecs.h (grecs_version_info): New struct.
(grecs_version, grecs_version_cmp): New protos.
(GRECS_NODE_FLAG_NOQUOTE): New flag.
* tests/gcfver.c: New file.
* tests/vercmp.at: New file.
* tests/.gitignore: Update.
* tests/Makefile.am: Define GRECS_VERCMP_AT in package.m4
(TESTSUITE_AT): Add vercmp.at (conditionally).
(noinst_PROGRAMS): Add gcfver.
* tests/testsuite.at: Conditionally include vercmp.at.
|
|
|
|
|