Age | Commit message (Collapse) | Author | Files |
|
|
|
* build-aux/getopt.m4: Only define lastoptlab if necessary
|
|
* build-aux/getopt.m4 (LASTOPT): New macro. Stops further
option processing.
|
|
|
|
* tests/gcfpeek.c: New options: -strcat -stradj
* tests/locus02.at: Use these.
|
|
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.
|
|
* build-aux/getopt.m4: Include grecs/opt.h
|
|
|
|
|
|
|
|
Port of a3f25ce2 from master.
* include/grecs/table.h (GRECS_CONST): New flag.
* src/tree.c (grecs_string_convert): For string types, free the
old value prior to assigning the new one, unless the GRECS_CONST
flag is set. In any case, clear the GRECS_CONST flag after
assigning new value.
|
|
Use _ptr_t suffix for typedefs that define pointers.
|
|
* Makefile.am (SUBDIRS): Add include
* am/grecs.m4 (GRECS_INCLUDES): Update
(GRECS_COND_BUILD_INSTALL)
(GRECS_COND_BUILD_SHARED)
(GRECS_COND_BUILD_STATIC): New conditions.
Build include/Makefile and include/grecs/Makefile.
* configure.ac: Use src/grecs-gram.y as a source
validity marker
* include/Makefile.a: New file.
* src/grecs.hin: Remove. Split into include/*. See below.
* include/grecs.h: New file.
* include/grecs/.gitignore: New file.
* include/grecs/Makefile.am: New file.
* include/grecs/doc.h: New file.
* include/grecs/error.h: New file.
* include/grecs/format.h: New file.
* include/grecs/lex.h: New file.
* include/grecs/list.h: New file.
* include/grecs/mem.h: New file.
* include/grecs/node.h: New file.
* include/grecs/parser.h: New file.
* include/grecs/preproc.h: New file.
* include/grecs/sockaddr.h: New file.
* include/grecs/symtab.h: New file.
* include/grecs/table.h: New file.
* include/grecs/tree.h: New file.
* include/grecs/txtacc.h: New file.
* include/grecs/types.h.in: New file.
* include/grecs/util.h: New file.
* include/grecs/value.h: New file.
* include/grecs/version.h: New file.
* src/grecs-locus.h: Move to ...
* include/grecs/locus.h: ... here
* src/grecsopt.h: Move to ...
* include/grecs/opt.h: ... here
* src/json.h: Move to ...
* include/grecs/json.h: ... here
* src/wordsplit.h: Move to ...
* include/wordsplit.h: ... here
* src/Make-inst.am (include_HEADERS): Remove.
* src/Make-shared.am (grecsinclude_HEADERS)
(noinst_HEADERS): Remove.
* src/Make-static.am (noinst_HEADERS): Remove.
* src/Make.am: Remove header-related stuff
* src/bind-gram.y: Fix includes.
* src/bind-lex.l: Likewise.
* src/cidr.c: Likewise.
* src/dhcpd-gram.y: Likewise.
* src/dhcpd-lex.l: Likewise.
* src/diag.c: Likewise.
* src/format.c: Likewise.
* src/grecs-gram.y: Likewise.
* src/grecs-lex.l: Likewise.
* src/json-gram.y: Likewise.
* src/json-lex.l: Likewise.
* src/jsonfmt.c: Likewise.
* src/lookup.c: Likewise.
* src/meta1-gram.y: Likewise.
* src/meta1-lex.l: Likewise.
* src/opthelp.c: Likewise.
* src/preproc.c: Likewise.
* src/sockaddr.c: Likewise.
* src/txtacc.c: Likewise.
* src/version.c: Likewise.
* tests/gcfenum.c: Likewise.
* tests/gcffmt.c: Likewise.
* tests/gcfpeek.c: Likewise.
* tests/gcfset.c: Likewise.
* tests/gcfver.c: Likewise.
* tests/json.c: Likewise.
|
|
|
|
* src/preproc.c (grecs_preproc_done): Reset static variables after free.
|
|
The default grecs parser closes stdin before returning. This might
cause grief for programs assuming that open(2) never returns 0.
* src/grecs-lex.l (yywrap): Avoid closing stdin. The yyin variable
has meaning only if grecs_preprocessor is set. Otherwise, it will
be assigned the pointer to stdin by lex-generated code.
|
|
|
|
* src/preproc.c (grecs_include_path_count): Return count.
|
|
|
|
* src/lineacc.c (grecs_line_acc_grow_char_unescape): If the escape
sequence is not defined, add the character itself and return 1.
Return 0 otherwise.
(grecs_line_acc_grow_unescape_last): Take pointer to locus as third
argument. If not NULL, print warning about undefined escape sequences.
All callers updated.
* src/parser.c (grecs_parse): Unless grecs_trace_flags is already set,
set it from the value of GRECS_DEBUG environment variable.
|
|
* src/symtab.c (grecs_symtab_remove): Return if no matching entry
was found.
|
|
* src/dhcpd-gram.y: Support assignments and conditional
expressions.
* src/dhcpd-lex.l: New exclusive states BOOL and EXPR.
* src/parsertab.c (parser_tab) [ENABLE_DHCPD_PARSER]: Define
dhcpd parser.
* tests/parser-dhcpd.at: New file.
* tests/Makefile.am: Add parser-dhcpd.at
* tests/testsuite.at: Likewise.
|
|
|
|
|
|
* src/grecs.hin (GRECS_CONST): New flag.
* src/tree.c (grecs_string_convert): For string types, free the
old value prior to assigning the new one, unless the GRECS_CONST
flag is set. In any case, clear the GRECS_CONST flag after
assigning new value.
|
|
* src/grecs.hin (grecs_list_compare)
(grecs_node_unlink): New protos.
* src/list.c (grecs_list_compare): New function.
* src/wordsplit.c (wordsplit_getwords): Word count is size_t
* src/wordsplit.h (wordsplit_getwords): Fix proto.
|
|
* src/meta1-lex.l: Fix erroneous #ifndef
|
|
* src/sockaddr.c (parse_inet): Handle GRECS_AH_PASSIVE
|
|
* src/list.c (grecs_list_remove_entry): Free the entry, but not its data.
All callers updated.
* src/txtacc.c (grecs_txtacc_free_string): Free the txtacc entry after
removal.
|
|
|
|
* src/grecs.hin (grecs_hash_string_ci): New proto.
* src/symtab.c (grecs_hash_string_ci): New function.
|
|
* src/json-gram.y (json_new_string)
(json_new_number,json_new_bool,json_new_null)
(json_new_object),json_new_null)
(json_new_object,json_new_array)
(json_object_set,json_object_get)
(json_array_size,json_array_flatten)
(json_array_insert,json_array_append)
(json_array_get): New functions.
* src/json.h (json_array): New member ol.
(json_unescape): Change signature.
Add new prototypes.
* src/json-lex.l: Return allocated string as T_STRING.
(json_unescape): Change signature.
* src/jsonfmt.c: Use new accessors. Don't escape / in strings.
|
|
* src/Make.am: Add jsonfmt.c
* src/json.h (json_format): New struct.
(json_format_value): New proto.
* src/jsonfmt.c: New file.
* tests/json.c: Use json_format_value.
|
|
* tests/wsp.c (make_env_kv): Fix array size
|
|
* src/bind-lex.l: Set noinput,nounput options
* src/dhcpd-lex.l: Likewise.
* src/meta1-lex.l: Likewise.
|
|
* src/Make-inst.am: Add json.h
* src/Make-shared.am: Likewise.
* src/Make-static.am: Likewise.
* src/Make.am: Likewise.
* src/json-gram.y: New file.
* src/json-lex.l: New file.
* src/json.h: New file.
* src/yytrans: Translate json prefixes.
* src/.gitignore: Update.
* tests/json.c: New file.
* tests/json00.at: New file.
* tests/json01.at: New file.
* tests/Makefile.am: Add new tests; build json
* tests/testsuite.at: Add new tests.
* tests/.gitignore: Update.
* am/grecs.m4: New flag "json"
* configure.ac (GRECS_SETUP): Require json
* src/Make-inst.am (include_HEADERS): Assign GRECS_HDR value.
* src/Make-shared.a [GRECS_COND_INSTALLHEADERS] (grecsinclude_HEADERS)
[!GRECS_COND_INSTALLHEADERS] (noinst_HEADERS): Likewise.
* src/Make-static.am (noinst_HEADERS): Likewise.
* src/Make.am [GRECS_COND_JSON]: Define GRECS_JSON and GRECS_EXTRA_JSON.
|
|
* src/wordsplit.h (WRDSX_WORD, WRDSX_QUOTE): New defines.
* src/wordsplit.c: Use them when initializing ws_escape.
|
|
|
|
* src/wordsplit.c (_WSNF_DELIM): New node flag
(wsnode_flagstr): Print 'd' for that flag.
(expvar): Don't set WRDSF_WS when expanding variable
value. This fixes, e.g., expansion of a$x if x begins with
a whitespace.
(wsnode_nullelim): A _WSNF_DELIM node breaks join chain.
(wordsplit_trimws): Don't affect nodes within join chains.
(scan_word): Set _WSNF_DELIM for returned delimiters.
* tests/wordsplit.at (TESTWSP): 8th argument - prologue
shell code. Use it to unset environment variables in
env/getenv tests.
Test ws elimination with return_delims set.
|
|
|
|
|
|
* 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.
|
|
|
|
|
|
* src/wordsplit.c (wordsplit_trimws): Retutn int.
(wordsplit_tildexpand,wordsplit_pathexpand): Add missing return.
(wordsplit_process_list): Rewrite in a table-driven fashion.
|
|
* src/wordsplit.c (wordsplit_tildexpand)
(wordsplit_pathexpand): New functions.
(wordsplit_process_list): Run tilde and pathname expansion
if WRDSF_PATHEXPAND flag is set.
* src/wordsplit.h (wordsplit)<ws_options>: New member.
(WRDSF_PATHEXPAND): New flag.
(WRDSO_NULLGLOB,WRDSO_FAILGLOB)
(WRDSO_DOTGLOB): New defines.
* tests/wsp.c: New options pathexpand, nullglob, failglob,
dotglob. Fix help output.
|
|
|
|
|