bookish.parser package¶
Submodules¶
bookish.parser.bootstrap module¶
bookish.parser.builder module¶
-
class
bookish.parser.builder.
Builder
(globals=None, file=None, context=None)¶ Bases:
object
-
add_alias
(callname, realname)¶
-
add_assertion
(fn, msgfn)¶
-
add_assignment
(rule, suffix, expr)¶
-
add_computed_assignment
(rule, suffix, fn)¶
-
add_import
(modname, bindname)¶
-
add_parms
(name, argnames)¶
-
arity
(rulename)¶
-
build_rule
(rule)¶
-
build_string
(content)¶
-
get_method
(n)¶
-
name
(rule)¶
-
qname
(rule)¶
-
run
(rulelist)¶
-
-
bookish.parser.builder.
build_meta
(content, outfile)¶
-
bookish.parser.builder.
parse_string
(content, ctx)¶
bookish.parser.parser module¶
-
exception
bookish.parser.parser.
ArgError
¶ Bases:
exceptions.Exception
-
class
bookish.parser.parser.
Failure
¶ Bases:
object
-
class
bookish.parser.parser.
Grammar
(ruledict, context=None, rulename=None)¶ Bases:
object
-
parse
(string, pos=0, debug=False, **extra)¶
-
parse_file
(fileobj, encoding='utf8')¶
-
push
(m)¶
-
snap
()¶
-
-
class
bookish.parser.parser.
Miss
(message, position, expr=None)¶ Bases:
object
-
class
bookish.parser.parser.
ParserContext
(m=None, parent=None, namespace=None, debug=False)¶ Bases:
bookish.util.Context
-
cache
¶
-
debug
¶
-
namespace
¶
-
set_debug
(v)¶
-
-
exception
bookish.parser.parser.
ParserError
¶ Bases:
exceptions.Exception
-
bookish.parser.parser.
condition_string
(c)¶
-
bookish.parser.parser.
make_grammar
(rulelist, context=None, rulename=None)¶
-
bookish.parser.parser.
make_rule
(name, expr, args, add=False)¶
-
bookish.parser.parser.
make_ruledict
(rulelist)¶
-
bookish.parser.parser.
parsed_meta_grammar
(debug=False)¶
-
bookish.parser.parser.
rules_from_locals
(localvars, namelist)¶
-
bookish.parser.parser.
rules_from_module
(mod)¶
bookish.parser.rules module¶
-
bookish.parser.rules.
ensure
(rule)¶
-
class
bookish.parser.rules.
Rule
(rulename=None, grammarpos=-1)¶ Bases:
object
-
accept
(stream, i, context, level=0)¶
-
arguments
()¶
-
arity
()¶
-
build
(builder)¶
-
children
()¶
-
dump
(tab=0)¶
-
firsts
()¶
-
fixed_length
(context)¶
-
getname
()¶
-
has_binding
(builder)¶
-
is_atomic
()¶
-
is_optional
()¶
-
matches
(stream, i=0, context=None, debug=False)¶
-
optional_firsts
()¶
-
repr
()¶
-
snap
(context)¶
-
test
(stream, i=0, context=None, debug=False)¶
-
test2
(stream, i=0, context=None, debug=False)¶
-
-
class
bookish.parser.rules.
Wrapper
(target, **kwargs)¶ Bases:
bookish.parser.rules.Rule
-
build
(builder)¶
-
children
()¶
-
dump
(tab=0)¶
-
firsts
()¶
-
fixed_length
(context)¶
-
has_binding
(builder)¶
-
is_atomic
()¶
-
is_optional
()¶
-
optional_firsts
()¶
-
repr
()¶
-
snap
(context)¶
-
-
class
bookish.parser.rules.
MultiRule
(targets)¶ Bases:
bookish.parser.rules.Rule
-
children
()¶
-
dump
(tab=0)¶
-
fixed_length
(context)¶
-
has_binding
(builder)¶
-
is_atomic
()¶
-
is_optional
()¶
-
snap
(context)¶
-
-
class
bookish.parser.rules.
Match
(item, **kwargs)¶ Bases:
bookish.parser.rules.Rule
-
build
(builder)¶
-
dump
(tab=0)¶
-
firsts
()¶
-
fixed_length
(context)¶
-
repr
()¶
-
-
class
bookish.parser.rules.
String
(string, **kwargs)¶ Bases:
bookish.parser.rules.Match
-
build
(builder)¶
-
firsts
()¶
-
fixed_length
(context)¶
-
repr
()¶
-
-
class
bookish.parser.rules.
In
(xs, **kwargs)¶ Bases:
bookish.parser.rules.Match
-
build
(builder)¶
-
firsts
()¶
-
fixed_length
(context)¶
-
repr
()¶
-
-
class
bookish.parser.rules.
Or
(targets, **kwargs)¶ Bases:
bookish.parser.rules.MultiRule
-
build
(builder)¶
-
firsts
()¶
-
fixed_length
(context)¶
-
optional_firsts
()¶
-
repr
()¶
-
-
class
bookish.parser.rules.
Seq
(targets, **kwargs)¶ Bases:
bookish.parser.rules.MultiRule
-
build
(builder)¶
-
firsts
()¶
-
fixed_length
(context)¶
-
repr
()¶
-
-
class
bookish.parser.rules.
Not
(*args, **kwargs)¶ Bases:
bookish.parser.rules.Wrapper
-
build
(builder)¶
-
firsts
()¶
-
fixed_length
(context)¶
-
repr
()¶
-
-
class
bookish.parser.rules.
Repeat
(target, mintimes=1, maxtimes=None, **kwargs)¶ Bases:
bookish.parser.rules.Wrapper
-
build
(builder)¶
-
dump
(tab=0)¶
-
firsts
()¶
-
fixed_length
(context)¶
-
is_optional
()¶
-
optional_firsts
()¶
-
repr
()¶
-
-
class
bookish.parser.rules.
Opt
(target, **kwargs)¶ Bases:
bookish.parser.rules.Repeat
-
build
(builder)¶
-
-
class
bookish.parser.rules.
Star
(target, **kwargs)¶ Bases:
bookish.parser.rules.Repeat
-
class
bookish.parser.rules.
Plus
(target, **kwargs)¶ Bases:
bookish.parser.rules.Repeat
-
class
bookish.parser.rules.
Peek
(target)¶ Bases:
bookish.parser.rules.Wrapper
-
build
(builder)¶
-
fixed_length
(context)¶
-
repr
()¶
-
-
class
bookish.parser.rules.
LookBehind
(*args, **kwargs)¶ Bases:
bookish.parser.rules.Wrapper
-
build
(builder)¶
-
dump
(tab=0)¶
-
fixed_length
(context)¶
-
repr
()¶
-
-
class
bookish.parser.rules.
Bind
(name, target, **kwargs)¶ Bases:
bookish.parser.rules.Wrapper
-
build
(builder)¶
-
dump
(tab=0)¶
-
has_binding
(builder)¶
-
repr
()¶
-
-
class
bookish.parser.rules.
Take
(target, **kwargs)¶ Bases:
bookish.parser.rules.Wrapper
-
build
(builder)¶
-
repr
()¶
-
-
class
bookish.parser.rules.
Do
(source, **kwargs)¶ Bases:
bookish.parser.rules.Rule
-
build
(builder)¶
-
dump
(tab=0)¶
-
fixed_length
(context)¶
-
repr
()¶
-
-
class
bookish.parser.rules.
If
(source, **kwargs)¶ Bases:
bookish.parser.rules.Do
-
build
(builder)¶
-
repr
()¶
-
-
class
bookish.parser.rules.
RecordChars
(target, **kwargs)¶ Bases:
bookish.parser.rules.Wrapper
-
build
(builder)¶
-
repr
()¶
-
-
class
bookish.parser.rules.
Regex
(pattern, **kwargs)¶ Bases:
bookish.parser.rules.Match
-
build
(builder)¶
-
firsts
()¶
-
fixed_length
(context)¶
-
repr
()¶
-
-
class
bookish.parser.rules.
Mixed
(until, target=None, **kwargs)¶ Bases:
bookish.parser.rules.Wrapper
-
build
(builder)¶
-
children
()¶
-
dump
(tab=0)¶
-
is_atomic
()¶
-
repr
()¶
-
snap
(context)¶
-
-
class
bookish.parser.rules.
FailIf
(*args, **kwargs)¶ Bases:
bookish.parser.rules.Wrapper
-
build
(builder)¶
-
firsts
()¶
-
fixed_length
(context)¶
-
repr
()¶
-
-
class
bookish.parser.rules.
PythonExpr
(ends, **kwargs)¶ Bases:
bookish.parser.rules.Rule
-
brackets
= {'(': ')', '[': ']', '{': '}'}¶
-
build
(builder)¶
-
endbrackets
= frozenset([')', '}', ']'])¶
-
static
take_python_expr
(stream, i, ends)¶
-
-
class
bookish.parser.rules.
Parms
(args, target, **kwargs)¶ Bases:
bookish.parser.rules.Wrapper
-
arguments
()¶
-
arity
()¶
-
build
(builder)¶
-
repr
()¶
-