45339e6f4ac8777701d3ecad108d8eee2b942ed8 kent Thu Sep 5 16:33:00 2019 -0700 Updating docs which had drifted a little from implementation, in the comments. diff --git src/lib/strex.c src/lib/strex.c index 3a2fc10..38c0933 100644 --- src/lib/strex.c +++ src/lib/strex.c @@ -1,63 +1,60 @@ /* strex - implementation of STRing EXPression language, currently used in tabToTabDir * to describe how the output fields are filled in from input fields. * * This is a little language implemented as a recursive descent parser that creates a * parse tree that can be quickly evaluated to produce a string output given an input * set of symbols. It is up to the evaluator to make up a symbol table, but an example of * using a hash as a symbol table is available. * * The language handles variables, string constants, numerical constants, and - * a very limited set of built in predefined functions. The numerical constants are only used for + * a set of built in predefined functions. The numerical constants are only used for * array indexes and some of the built in functions. All functions return string values, and * all variables have string values. * * You can build up strings with the '+' operator, which concatenates two strings. * String constants can be either " or ' delimited * * You can parse apart strings with the built in functions and with the subscript [] operator. * The built in functions are described in a separate doc, which will hopefully still be * available in the same directory as this file as strex.doc when you read this. - * - * The subscript operator treats the string it is applied to as a comma separated value array. - * It really is not very efficient alas. */ #include "common.h" #include "linefile.h" #include "hash.h" #include "dystring.h" #include "sqlNum.h" #include "localmem.h" #include "csv.h" #include "tokenizer.h" #include "hmac.h" #include "errAbort.h" #include "strex.h" enum strexType /* A type within parse tree or built in function specification. */ { strexTypeBoolean = 1, strexTypeString = 2, strexTypeInt = 3, strexTypeDouble = 4, }; enum strexBuiltInFunc -/* One of these for each builtIn. We'll just do a switch to implement +/* One of these for each builtIn. We'll just do a switch to implement. * Each built in function needs a value here, to keep it simple there's * aa correspondence between these names and the built in function name */ { strexBuiltInTrim, strexBuiltInBetween, strexBuiltInWord, strexBuiltInNow, strexBuiltInMd5, strexBuiltInChop, strexBuiltInUncsv, strexBuiltInUntsv, strexBuiltInReplace, strexBuiltInFix, strexBuiltInStrip, strexBuiltInLen,