summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* Makefile: detect when y.tab.h doesn't change.Kaz Kylheku2017-04-191-0/+5
| | | | | | | | | | | | | | | | When we touch the parser.y file, yacc regenerates y.tab.h. Then everything which depends on that is rebuilt. However, this is not necessary if the parser.y change doesn't actually modify the contents of y.tab.h. A build system based on file hashes wouldn't have this problem, but make works strictly with modification timestamps. * Makefile (y.tab.c): Preserve the old y.tab.h, if it exists, as y.tab.h.old. Then if the new y.tab.h is exactly the same according to cmp, restore the old y.tab.h in its place. (clean): Remove y.tab.h.old.
* New buffer data type.Kaz Kylheku2017-04-164-4/+71
| | | | | | | | | | | | | | | | | | | | | | | Work in progress. * gc.c (finalize): Add cast to switch expression so gcc flags when we are missing one of the enumerations. Handle new BUF enum to free dynamic buffers. (mark_obj): Mark len and size fields of buf, in case they aren't just nil or integers. * hash.c (hash_buf): New static function. (equal_hash): Route BUF type to hash_buf. * lib.c (buf_s): New symbol variable. (code2type): Handle BUF. (equal): Handle BUF using memcmp on the data. (obj_init): Intern buf symbol and initialize buf_s. * lib.h (type_t): New enum member BUF. (struct buf): New type. (union obj): New member b, of struct buf type. (buf_s): Declared.
* Bugfix: incorrect substitution in suspend macro.Kaz Kylheku2017-04-151-1/+1
| | | | | | * share/txr/stdlib/yield.tl (suspend): The body forms must be inserted into a progn, because sys:abscond-from just takes one optional value to evaluate.
* Bugfix expansion: return-from, sys:abscond-from, block*.Kaz Kylheku2017-04-151-3/+8
| | | | | | | | | | | | | | These three forms are not being traversed properly by the macro expander. * eval.c (do_expand): Do not treat return-from, sys:abscond-from and block* in the same case as block. block* evaluates all of its forms and so can just be walked as a function call in the fallback case. The other two must be in their own case because we must not use expand_progn on them; they do not evaluate a progn-like list of forms. This leads to inappropriate optimizations like (return-from x (progn a b c)) -> (return-from x a b c).
* Protect internal symbols from uninterning.Kaz Kylheku2017-04-154-3/+273
| | | | | | | | | | | | | | | | | | | | Issue: TXR holds numerous symbol references in global variables, like list_s. These variables are not registered as root pointers with the garbage collector. This is normally okay because symbols are reachable via packages. However, if such a symbol is uninterned, that causes an integrity problem. Solution: protect those symbols from being removed from their packages. * Makefile (OBJS): Add protsym.o. * genprotsym.txr, protsym.c: New files. * lib.c (prot_sym_check): New static function. (use_sym, uintern, rehome_sym): Use prot_sym_check to implement a defense against internal symbols being booted out of their package.
* Make it a warning only when built-ins redefined.Kaz Kylheku2017-04-141-4/+4
| | | | | | | * eval.c (builtin_reject_test): Issue warnings rather than errors when built-in macros, functions or operators are redefined. For now, we don't provide any way to suppress the warning.
* Honor *print-circle* disabling in print methods.Kaz Kylheku2017-04-121-6/+10
| | | | | | * lib.c (obj_print): Don't assume that if we have a circle printing context in the stream, circle printing is enabled. Check the variable.
* Bugfix: missing usr:end and usr:single symbols.Kaz Kylheku2017-04-111-0/+6
| | | | | | | | | | | | | | When TXR pattern language code is canned in the context of an alternative *package* which uses the usr package, the scanner will throw false errors on @(end) and @(single). This is because these symbols don't exist in the usr package and will get interned in the current package. The scanner will then complain that they are not in the usr package. * match.c (syms_init): Intern end and single in the usr package, but don't store the return value in any variable.
* New path slot in stat struct.Kaz Kylheku2017-04-085-15/+40
| | | | | | | | | | | | | | | | | | | | | | | | * ftw.c (ftw_callback): Pass path to stat_to_struct function. * socket.c (path_s): Variable definition removed from here. (sock_load_init): Do not intern path symbol here. * sysif.c (path_s): Variable definition moved here. (stat_to_struct): New parameter, path. Store its argument in the path slot of the structure. (stat_impl): New parameter, path. Pass argument to stat_to_struct. (statp, statl): Pass path down to stat_impl. (statf): Pass nil down as path argument of stat_impl. (sysif_init): Intern path symbol here. Add path_s to the slot list in the make_struct_type call which creates the stat structure type. * sysif.h (path_s): Declared here now. (stat_to_struct): Declaration updated. * txr.1: Documented new slot of stat structure and behavior of stat, lstat and fstat w.r.t. this slot.
* parser: add some error cases to hash notations.Kaz Kylheku2017-04-081-1/+9
| | | | | | | | Produce better diagnostics for expressions like #[... or #Habc. * parser.y (vector, hash, struct, range): Add error productions.
* parser: refactor grammar to banish #[] etc.Kaz Kylheku2017-04-071-16/+26
| | | | | | | | | | | | | | | | | | | | Turns out we have an over-eager parser whcih recognizes invalid notion such as #[...], #S[...] and others. This is because the grammar nonterminal list is overloaded with phrase structures. The syntax of a vector literal, for instance, is '#' list, but a list can be '[' ... and other expressions. * parser.y (dwim, meta, compound): New non-terminal symbols. Dwim derives the square bracketed "dwim" expressons that were previously overloaded into list. Meta derives the @ exprs. compound is what list used to be. (list): Handle only (...) list expressions. (o_elem, modifiers): Derives compound rather than list, thus preserving existing behavior. (i_expr, n_expr): Likewise. All other uses references to the list nonterminal stay, thereby trimming the grammar of dubious expressions.
* listener: :p and :prompt commands.Kaz Kylheku2017-04-062-0/+42
| | | | | | | | | * parser.c (repl): Support :p and :prompt commands for printing the current prompt, which is useful in plain mode. * txr.1: Document the new commands under Interactive Listener. Also plain mode is documented again here, though it is described for -n/--noninteractive.
* Indexing in variable subst applies to any sequence.Kaz Kylheku2017-04-053-14/+47
| | | | | | | | | | | | | | | | | | | | The @{a [3]} syntax in quasiliterals and @(output) now indexes into the original object a if it is any sequence kind, not specifically a list. Otherwise it indexes into its string representation. * eval.c (format_field): Combine the elements of the object with the separator if it is any sequence type other than a string. Subject to compat option. (subst_vars): Avoid converting any kind of sequence to string, rather than just lists. After any field formatting is applied, if the object is any sequence (not just alist), combine the elements with a space. All subect to compat option. * match.c (tx_subst_vars): Same treatment as subst_vars. * txr.1: Compatibility notes added.
* quasiliterals: issue in printing embedded syms.Kaz Kylheku2017-04-051-28/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The op macro replaces syntax like @3 with gensyms. The problem is these genyms are not wrapped with (sys:var ...). For instance: `foo@{1}bar` ;; (sys:quasi "foo" (sys:var 1 () ()) "bar") might, inside an op expression turn into: (sys:quasi "foo" #:arg001 "bar") If this object is printed, it renders as `foo#:arg001bar` which is garbage syntax. After this fix, that will come out as: `foo@{#:arg001}bar` It is not read/print consistent, but it has the same meaning under evaluation. * lib.c (out_quasi_str_sym): New static function. Formed out of a block of code taken from out_quasi_str. (out_quasi_str): Print (sys:var ...) symbols via a call to out_quasi_str_sym, eliminating a block of code. If an element itself is a symbol, then print that using out_quasi_str_sym also.
* Version 174.txr-174Kaz Kylheku2017-04-046-78/+118
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* parser: C++ regression.Kaz Kylheku2017-04-041-30/+30
| | | | | | | * parser.l (grammar): Pass yyg to directive_tok rather than yyscanner. It has the yyguts_t * type, whereas yyscanner is a void * version of the same pointer.
* Connect -n option to linenoise noninteractive mode.Kaz Kylheku2017-04-043-1/+21
| | | | | | | | | | * parser.c (repl): Set noninteractive mode from noninteractive option. * txr.c (help): Mention effect of -n upon listener. * txr.1: Documented effect of -n/--noninteractive on the listener.
* linenoise: support forcing of noninteractive mode.Kaz Kylheku2017-04-042-1/+14
| | | | | | | | | | | | * linenoise/linenoise.c (struct lino_state): New member, noninteractive. (lino_set_noninteractive, lino_get_noninteractive): New functions. (linenoise): Check noninteractive flag; if set, treat the situation like !isatty(ls->ifd). * linenoise/linenoise.h (lino_set_noninteractive, lino_get_noninteractive): Delared.
* parser: bugfix: don't scan @NUM in QSPECIAL state.Kaz Kylheku2017-04-041-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem is syntax like `@@12a` being scanned as if it were `@{@12}a` rather than @{@12a}`. When the scanner is in the middle of a quasiliteral, in the QSILIT state and sees a @, it transitions to the QSPECIAL state. In the QSPECIAL state, the METANUM token syntax is recognized consisting of @ followed by a decimal, octal or hex number. In the same QSPECIAL state, however, a meta-variable like @abc is not recognized as a unit; rather, a @ is recognized by itself, and abc by itself. Thus when @12a is seen in the QSPECIAL state, the @12 is the longest match. The fix is to treat METANUM tokens the same way in the QSPECIAL state: just recognize a number without the @ prefix, and report as a METANUM. * parser.l (grammar): Split the pattern in all four METANUM rules so that in the NESTED, BRACED, QSLIT and QWLIT states, the number is recognized together with the @ prefix. But in the QSPECIAL state, indicating that one or more @ characters have been seen, just recognize a number without the prefix as a METANUM.
* New time-parse-local and time-parse-utc functions.Kaz Kylheku2017-04-044-6/+56
| | | | | | | | | | | | | | | * eval.c (eval_init): Register intrinsic functions time-parse-local and time-parse-utc. * lib.c (strptime_wrap): New static function. (time_parse): Now implemented as by call to strptime_wrap. (time_parse_local, time_parse_utc): New functions. These get the time_t time from struct tm without constructing the intermediate Lisp structure. * lib.h (time_parse_local, time_parse_utc): Declared. * txr.1: Documented new functions.
* linenoise: bugfix: use persistent stream for non-tty.Kaz Kylheku2017-04-031-12/+18
| | | | | | | | | | | | | | This bug causes data to be thrown away after reading one line. * linenoise/linenoise.c (struct lino_state): New member, ifs. (linenoise): Do not fdopen a new stream on each call, because this will read a buffer full of data, from which it will just read one line, and then throw the rest of away when fclose is called on the stream. Open the stream once and store it in the ifs member. (lino_cleanup): If the ifs member is non-null, then call fclose on it.
* apply and iapply bugfix: split sequences into args.Kaz Kylheku2017-04-032-3/+21
| | | | | | | | | | | | | | | | | | | | | These functions don't conform with the documentation. For instance [apply list "abc"] yields "abc". It is supposed to yield (#\a #\b #\c), since the characters of "abc" must become individual arguments to list. Part of the fix is in the apply_frob_args logic; however, we have to clone that function because it is used for implementing other things which will break: we cannot, for for example, have (list* 1 "ab") producing (1 #\a #\b). * eval.c (apply_intrisic_frob_args): New static function. Differs from apply_frob_args in that it calls tolist on the final element. (apply_intrinsic): Use apply_intrinsic_frob_args instead of apply_frob_args. (iapply): Invoke tolist on the value assigned to last_arg. * txr.1: Add a clarifying note for iapply that the terminating atom is not split into arguments if it is a sequence.
* doc: add notes to copy-struct.Kaz Kylheku2017-04-031-0/+42
| | | | | | * txr.1: copy-struct is a low-level mechanism. Higher level object cloning must be built on top of it, if required. This is now noted in the documentation.
* doc: hash-update grammar.Kaz Kylheku2017-04-021-1/+1
| | | | * txr.1: number agreement: "each values" -> "each value".
* doc: run-on paragraph under car, cdr, nullfiy method.Kaz Kylheku2017-04-021-1/+3
| | | | | * txr.1: Under the description of the car, cdr and nullify methods, the description of car must start a new paragraph.
* doc: clarify behavior of mutated keys in hashing.Kaz Kylheku2017-04-021-3/+27
| | | | | | | | | | | * txr.1: Under description of the equal method, replace the text about a hash table "not working reliably" with proper "unspecified behavior" terminology. Add some paragraphs to the introduction to hash tables about the issue of modifying the car fields of hash entry cells, or mutating the keys in equal-based hash tables such that their equality is affected. Re-iterate some of these points in a few other places under the descriptions of some hash-related functions.
* parser: fix a...b syntax error.Kaz Kylheku2017-04-021-0/+6
| | | | | | | | | | | | | This issue has implications mainly for read/print consistency. The (rcons a .b) expression prints a...b, but that doesn't read back. The reason is that the . on .b isn't preceded by whitespace, and so isn't the UREFDOT token recognized in a n_expr. It's just the '.' token which is a syntax error in that situation. * parser.y (n_expr): New special case rule to handle the phrase pattern n_expr DOTDOT '.' n_expr which is now a syntax error.
* parser: do not reject 0.1..0.2 range.Kaz Kylheku2017-04-021-2/+1
| | | | | * parser.l: Remove the pattern match which causes 0.1..0 to be rejected.
* parser: diagnose syntax like 0.1.2 and .1.1.Kaz Kylheku2017-04-021-3/+3
| | | | | | | | | Currently (list .1.1) yields (0.1 0.1). This is evading the rule for catching cramped floating-point literals. * parser.l (grammar): Carefully weaken the pattern match in the relevant rule for catching cramped floating-point literals, so it matches these cases.
* Bugfix: .1 treated as dot if preceded by space.Kaz Kylheku2017-04-021-4/+4
| | | | | | | | | | | | Some recent work in supporting .slot syntax (uref dot) broke the treatment of floating point literals. This is because part of the trick is that a uref dot is recognized with leading whitespace as part of the token. But that of course means it steals the match for some floating-point tokens; oops! * parser.l (grammar): All rules for floating-point tokens which can match a leading decimal point now munch optional whitespace first.
* Get rid of config/ directory.Kaz Kylheku2017-03-312-124/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | We revert back to config.h, config.make and config.log just being in the root of the build directory, rather than in a config/ subdirectory, like it was until mid 2014. That change was done for the sake of the tainting problem: a build directory picking up the wrong config.h from a source directory that is itself in the a configured state. * Makefile: Include config.make rather than config/config.make. (TXR_CFLAGS): Remove config directory from include file search path. (OBJS, EXTRA_OBJS, y.tab.c, y.tab.h, lex.yy.c): Dependencies on config.h and config.make adjusted to point to new location. (distclean): Use rm -f on config.*, not rm -rf; we don't expect there to be a directory matching that pattern. Remove config.h, config.make and config.log rather than config directory. Extend the generic distclean to remove opt and dbg, because this change will trigger its use and lingering .d files in opt and dbg will break the build. Remove txr-win.exe and txr-dbg-win.exe in generic distclean. * configure (conf_dir, config_h, config_make, config_log): Variables gone, replaced by hard-coded strings everywhere. Generate config.make, config.log and config.h in the current directory rather than a subdirectory. Do not generate a conf_dir variable into config.make.
* build: defend against $(top_srcdir) interference.Kaz Kylheku2017-03-311-0/+11
| | | | | | | | | | | * Makefile (tainted): New top target added in a situation when an out-of-tree build is tainted by a configuration in the original tree. The problem is that .c files which have an #include "y.tab.h" or #include "config.h" get these headers from the same directory where they reside. This is processed ahead of any -iquote directories. If a "config.h" exists in $(top_srcdir), files include that in spite of "-iquote ." on the compiler command line.
* Fix broken out-of-tree build.Kaz Kylheku2017-03-311-1/+2
| | | | | | | | | | | Reported by Marco Wahl. When building in a separate directory, the y.tab.h file isn't found because the current directory is not searched by the compiler. It searches only the original source tree and the local config directory. * Makefile (TXR_CFLAGS): We must have . in the include file search path otherwise files can only find y.tab.h when it's in the same directory where they are.
* Important improvement in opip: support slot access.Kaz Kylheku2017-03-292-2/+11
| | | | | | | | | | * eval.c (me_opip): Just like dwim forms are left untransformed, we also leave untransformed (uref ...) and (qref ...) forms. Otherwise they get wrapped in the (do ...) syntax and don't work right. This treatment is so broken/useless that no compatibility switch is needed here. * txr.1: Documentation for opip/oand updated.
* Package prefix handling on directive symbols.Kaz Kylheku2017-03-272-30/+161
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The directives which are involved in special phrase structure syntax like @(collect), @(end), @(and) and many others have always been a hack, recognized specially in the lexical analyzer and handled in the parser. The identifiers were not treated via the normal Lisp interning mechanism. In this patch, we try to make the illusion more complete and functional. Going forward, these symbols are understood as being interned in the usr package. As a special relaxation, keyword symbols may be used in their place, so that @(:end) is the same as @(end) and @(:collect) is the same as @(collect). Suppose that @(collect) is scanned, but the collect symbol interned in the current package isn't usr:collect, or keyword:collect. Then this is an error. Further, package prefixes may be used. The syntax @(abc:collect) is still valid and is still recognized as the head of the @(collect) phrase structure syntax. However, if abc:collect isn't the same symbol as either usr:collect or :collect, then an error is triggered. * parser.l (grammar): Recognize optional package prefixes on directive phrase structure identifiers. (directive_tok): Extract package prefix and symbol from lexeme. Implement the above described checks for all the cases. * txr.1: Added description of this under the Packages and Symbols section.
* Lexer refactoring: special syntax tokens.Kaz Kylheku2017-03-271-90/+43
| | | | | | * parser.l (directive_tok): New static function. (grammar): Replace repeated code with calls to directive_tok.
* Version 173.txr-173Kaz Kylheku2017-03-256-148/+182
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* termios: broken go-cbreak method.Kaz Kylheku2017-03-251-1/+1
| | | | | * share/txr/stdlib/termios.tl (termios go-raw): Fix call to nonexistent method.
* Windows: improve 16x16 icon.Kaz Kylheku2017-03-242-0/+0
| | | | | | | | | | Not sharpening it, but extending the opaque white background, with some alpha fuzzing by hand. Looks better defined on window title. * win/txr.xcf: 16x16 icon layer edited. * win/txr.ico: Updated.
* Windows: shortcuts should start in user profile dir.Kaz Kylheku2017-03-241-0/+1
| | | | | | | | | | | | Noticed that the shortcuts created by NSIS are configured to start in the TXR standard library installation directory. Why is that? Because the locatio specified by the most recent SetOutPath is used for this! * inst.nsi: Before creating shortcuts, switch SetOutPath to $PROFILE, which is NSIS's variable denoting the user's profie directory, same as the Windows USERPROFILE environment variable.
* doc: cross reference call-finalizers.Kaz Kylheku2017-03-241-0/+4
| | | | | * txr.1: Under finalize function mention that finalizers can also be called using call-finalizers.
* doc: reference to nonexistent special var.Kaz Kylheku2017-03-241-2/+2
| | | | | * txr.1: Fix references to nonexistent *package-list* variable under Handlers and Sandboxing.
* Short-circuit lisp-1 expander for atoms.Kaz Kylheku2017-03-241-0/+3
| | | | | | * eval.c (expand_lisp1): if the form is an atom that is not a bindable symbol, just return it; don't wastefully call into expand which has to save and restore some context.
* bugfix: neglected unbound warnings in DWIM syntax.Kaz Kylheku2017-03-241-0/+4
| | | | | | | | | | | DWIM expressions like [a b c] are not raising expansion-time warnings about a, b, c being unbound. * eval.c (expand_lisp1): The problem is that here we just return in the case that the symbol is bindable and has no macro expansion! Before returning, we must check whether the symbol has a binding in the variable or function space. If not, raise a warning.
* trace: wrong function printed in traces.Kaz Kylheku2017-03-241-3/+4
| | | | | | | | | | | | When tracing for two or more functions is enabled in a single trace form, the the function tracing hooks print the wrong name for all but the rightmost function. * share/txr/stdlib/trace.tl (sys:trace): Fix code which assumes that the each operator binds fresh lexical variables on each iteration. Bind a fresh lexical variable lex-n which copies the current value of the loop variable n, and refer to this lexical out of the tracing lambda.
* Some basic tests for finalization.Kaz Kylheku2017-03-242-0/+105
| | | | | | * tests/012/fini.tl: New file. * tests/012/fini.expected: New file.
* Warn when a nonexistent slot is referenced.Kaz Kylheku2017-03-233-10/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implementing warning for the situaton when the qref, uref, usl and umeth macro operators are asked to refer to a slot that doesn't exist in any struct type. This won't catch errors referencing a slot on the wrong type, but it will catch slots that are misspelled in such a way that the typo doesn't land on any slot. * share/txr/stdlib/struct.tl (defstruct): Register tenative slot definitions for all slots to nuke warnings. (sys:check-slot): New function. (qref, usl, umeth): Check slots with sys:check-slot. (uref): Drop :whole argument, which is unused. (defmeth): Register tentative definition for slot. * struct.c (slot_s, static_slot_s): New symbol variables. (slot_type_hash, static_slot_type_hash): New hash tables, associating symbols with lists of struct type names in which they are defined. (struct_init): Initialize and gc-protect hashes. Initialize new symbols, interning in system package. Register new intrinsic funtions sys:slot-types and sys:static-slot-types. (make_struct_type): Register slots in new hashes. (static_slot_ens_rec): Register new slow in static slot hash. (slot_types, static_slot_types): New functions, registered as intrinsics. (slot_type_reg, static_slot_type_reg): New functions. * struct.h (print_s): Declared. (slot_s, static_slot_s): Declared. (slot_types, static_slot_types, slot_type_reg, static_slot_type_reg): Declared.
* call-finalizers: allow recursion.Kaz Kylheku2017-03-232-41/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Code to invoke finalizers and remove them from the list is consolidated: both the gc and call-finalizers now use the same lower-level function. Finalizers may now themselves call-finalizers; it is no longer "unspecified behavior". This greatly improves the the TXR Lisp support for RAII, since :fini handlers of objects can call finalization on related objects. For instance a container being finalized can call the finalizers of contained objects. * gc.c (call_finalizers_impl): New function. Gathers all eligible finalizer registrations into a local list, first, removing them from the global list. Then does the calls in a second pass. Also, relative to the original functions which it replaces, this fixes an incorrect case: when the list is of length 1 and contains an eligible entry, in which case the global final_tail pointer is left aiming at a local variable! (is_reachable_final): New static function. (call_finalizers): Use call_finalizers_impl, specifying is_reachable_final as the predicate. (is_matching_final): New static function. (gc_call_finalizers): Use call_finalizers_impl, specifying is_matching_final as the predicate. * txr.1: Update documentation about call-finalizers.
* Bind variable during directive delimited match.Kaz Kylheku2017-03-222-1/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | The existing behavior is: when a situation like @a@(foo) performs a search for the match for @(foo) in order to determine the extent of the text matched by variable a, the variable a is not bound. That is to say, @(foo) is tried in an environment in which a doesn't exist. The variable is only bound when the search succeeds, and then @(foo) is processed again, with the variable now available. The new behavior is that @(foo) is tested in an environment in which a is bound. The variable's value is bound to the range of text between the original position and the tested position where @(foo) is tried. This is subject to the copatibility option. * match.c (ml_bindings_specline_pos): New static function. (search_match_binding_var): New static function, variant of search_match. (h_var): In the var-delimited-by-directive case, perform the search using search_match_binding_var, unless <= 172 compatibility is requested. * txr.1: Compatibility note added.
* Remove useless consume_prefix call.Kaz Kylheku2017-03-221-2/+0
| | | | | | | | | * match.c (search_match): Calling consume_prefix from this function does nothing because it does not advance c->pos, and so it is hereby removed. This was introduced in commit fce7c87fa0099e5414607676fc73c9dfa9d7649c on 2012-02-11, at the same time when consume_prefix was introduced.