summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorptmcg <ptmcg@9bf210a0-9d2d-494c-87cf-cfb32e7dff7b>2007-12-19 13:47:49 +0000
committerptmcg <ptmcg@9bf210a0-9d2d-494c-87cf-cfb32e7dff7b>2007-12-19 13:47:49 +0000
commitfd4bc37dde959e8abe2aa95c9c1079de24331b9a (patch)
treeb313b6b81a1a4de211433c1e3508962c74299fa8
parent6397fbf9184d4d753dde8291cdb89e8401cc9df8 (diff)
downloadpyparsing-fd4bc37dde959e8abe2aa95c9c1079de24331b9a.tar.gz
Include changes made in 1.4.7 version of this file
git-svn-id: svn://svn.code.sf.net/p/pyparsing/code/src@136 9bf210a0-9d2d-494c-87cf-cfb32e7dff7b
-rw-r--r--HowToUsePyparsing.txt21
1 files changed, 20 insertions, 1 deletions
diff --git a/HowToUsePyparsing.txt b/HowToUsePyparsing.txt
index 80c8714..1ac3a8b 100644
--- a/HowToUsePyparsing.txt
+++ b/HowToUsePyparsing.txt
@@ -146,7 +146,23 @@ Usage notes
- Parse actions can be used to convert values from strings to
other data types (ints, floats, booleans, etc.).
+
+- Results names are recommended for retrieving tokens from complex
+ expressions. It is much easier to access a token using its field
+ name than using a positional index, especially if the expression
+ contains optional elements. ***NEW IN 1.4.7*** You can now shortcut
+ the setResultsName call::
+
+ stats = "AVE:" + realNum.setResultsName("average") + \
+ "MIN:" + realNum.setResultsName("min") + \
+ "MAX:" + realNum.setResultsName("max")
+ can now be written as this::
+
+ stats = "AVE:" + realNum("average") + \
+ "MIN:" + realNum("min") + \
+ "MAX:" + realNum("max")
+
- Be careful when defining parse actions that modify global variables or
data structures (as in ``fourFn.py``), especially for low level tokens
or expressions
@@ -240,11 +256,14 @@ methods for code to use are:
If ``fn`` does not modify the ``toks`` list, it does not need to return
anything at all.
+- ``setBreak( breakFlag=True )`` - if breakFlag is True, calls pdb.set_break()
+ as this expression is about to be parsed
+
- ``copy()`` - returns a copy of a ParserElement; can be used to use the same
parse expression in different places in a grammar, with different parse actions
attached to each
-- ``leaveWhiteSpace()`` - change default behavior of skipping
+- ``leaveWhitespace()`` - change default behavior of skipping
whitespace before starting matching (mostly used internally to the
pyparsing module, rarely used by client code)