SchemeParser

class lilypondparsertools.SchemeParser(debug=False)

SchemeParser mimics how LilyPond’s embedded Scheme parser behaves.

It parses a single Scheme expression and then stops, by raising a SchemeParserFinishedError.

The parsed expression and its exact length in characters are cached on the SchemeParser instance.

It is intended to be used only in conjunction with LilyPondParser.

Lineage

digraph InheritanceGraph { graph [background=transparent, bgcolor=transparent, color=lightslategrey, fontname=Arial, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, root="__builtin__.object", splines=spline, style="dotted, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=12, penwidth=2, style="filled, rounded"]; edge [color=lightsteelblue2, penwidth=2]; subgraph cluster_abctools { graph [label=abctools]; "abjad.tools.abctools.AbjadObject.AbjadObject" [color=1, group=0, label=AbjadObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" [color=1, group=0, label=AbstractBase, shape=box]; "abjad.tools.abctools.Parser.Parser" [color=1, group=0, label=Parser, shape=oval, style=bold]; "abjad.tools.abctools.AbjadObject.AbjadObject" -> "abjad.tools.abctools.Parser.Parser"; "abjad.tools.abctools.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_lilypondparsertools { graph [label=lilypondparsertools]; "abjad.tools.lilypondparsertools.SchemeParser.SchemeParser" [color=black, fontcolor=white, group=2, label=<<B>SchemeParser</B>>, shape=box, style="filled, rounded"]; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } "abjad.tools.abctools.Parser.Parser" -> "abjad.tools.lilypondparsertools.SchemeParser.SchemeParser"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

debug True if the parser runs in debugging mode.
lexer The parser’s PLY Lexer instance.
lexer_rules_object Lexer rules object of Scheme parser.
logger The parser’s Logger instance.
logger_path The output path for the parser’s logfile.
output_path The output path for files associated with the parser.
p_boolean__BOOLEAN(p) boolean : BOOLEAN
p_constant__boolean(p) constant : boolean
p_constant__number(p) constant : number
p_constant__string(p) constant : string
p_data__EMPTY(p) data :
p_data__data__datum(p) data : data datum
p_datum__constant(p) datum : constant
p_datum__list(p) datum : list
p_datum__symbol(p) datum : symbol
p_datum__vector(p) datum : vector
p_error(p)
p_expression__QUOTE__datum(p) expression : QUOTE datum
p_expression__constant(p) expression : constant
p_expression__variable(p) expression : variable
p_form__expression(p) form : expression
p_forms__EMPTY(p) forms :
p_forms__forms__form(p) forms : forms form
p_list__L_PAREN__data__R_PAREN(p) list : L_PAREN data R_PAREN
p_list__L_PAREN__data__datum__PERIOD__datum__R_PAREN(p) list : L_PAREN data datum PERIOD datum R_PAREN
p_number__DECIMAL(p) number : DECIMAL
p_number__HEXADECIMAL(p) number : HEXADECIMAL
p_number__INTEGER(p) number : INTEGER
p_program__forms(p) program : forms
p_string__STRING(p) string : STRING
p_symbol__IDENTIFIER(p) symbol : IDENTIFIER
p_variable__IDENTIFIER(p) variable : IDENTIFIER
p_vector__HASH__L_PAREN__data__R_PAREN(p) vector : HASH L_PAREN data R_PAREN
parser The parser’s PLY LRParser instance.
parser_rules_object Parser rules object of Scheme parser.
pickle_path The output path for the parser’s pickled parsing tables.
t_BOOLEAN(t) #(T|F|t|f)
t_DECIMAL(t)
t_HASH(t) #
t_HEXADECIMAL(t)
t_IDENTIFIER(t)
t_INTEGER(t)
t_L_PAREN(t) (
t_R_PAREN(t) )
t_anything(t) .
t_error(t)
t_newline(t) n+
t_quote(t)
t_quote_440(t) \[nt\’”]
t_quote_443(t) [^\”“]+
t_quote_446(t)
t_quote_456(t) .
t_quote_error(t)
t_whitespace(t) [ tr]+
tokenize(input_string) Tokenize input string and print results.
__call__(input_string) Parse input_string and return result.
__eq__(expr) Is true when ID of expr equals ID of Abjad object.
__format__([format_specification]) Formats Abjad object.
__hash__() Hashes Abjad object.
__ne__(expr) Is true when Abjad object does not equal expr.
__repr__() Gets interpreter representation of Abjad object.

Read-only properties

(Parser).debug

True if the parser runs in debugging mode.

(Parser).lexer

The parser’s PLY Lexer instance.

SchemeParser.lexer_rules_object

Lexer rules object of Scheme parser.

(Parser).logger

The parser’s Logger instance.

(Parser).logger_path

The output path for the parser’s logfile.

(Parser).output_path

The output path for files associated with the parser.

(Parser).parser

The parser’s PLY LRParser instance.

SchemeParser.parser_rules_object

Parser rules object of Scheme parser.

(Parser).pickle_path

The output path for the parser’s pickled parsing tables.

Methods

SchemeParser.p_boolean__BOOLEAN(p)

boolean : BOOLEAN

SchemeParser.p_constant__boolean(p)

constant : boolean

SchemeParser.p_constant__number(p)

constant : number

SchemeParser.p_constant__string(p)

constant : string

SchemeParser.p_data__EMPTY(p)

data :

SchemeParser.p_data__data__datum(p)

data : data datum

SchemeParser.p_datum__constant(p)

datum : constant

SchemeParser.p_datum__list(p)

datum : list

SchemeParser.p_datum__symbol(p)

datum : symbol

SchemeParser.p_datum__vector(p)

datum : vector

SchemeParser.p_error(p)
SchemeParser.p_expression__QUOTE__datum(p)

expression : QUOTE datum

SchemeParser.p_expression__constant(p)

expression : constant

SchemeParser.p_expression__variable(p)

expression : variable

SchemeParser.p_form__expression(p)

form : expression

SchemeParser.p_forms__EMPTY(p)

forms :

SchemeParser.p_forms__forms__form(p)

forms : forms form

SchemeParser.p_list__L_PAREN__data__R_PAREN(p)

list : L_PAREN data R_PAREN

SchemeParser.p_list__L_PAREN__data__datum__PERIOD__datum__R_PAREN(p)

list : L_PAREN data datum PERIOD datum R_PAREN

SchemeParser.p_number__DECIMAL(p)

number : DECIMAL

SchemeParser.p_number__HEXADECIMAL(p)

number : HEXADECIMAL

SchemeParser.p_number__INTEGER(p)

number : INTEGER

SchemeParser.p_program__forms(p)

program : forms

SchemeParser.p_string__STRING(p)

string : STRING

SchemeParser.p_symbol__IDENTIFIER(p)

symbol : IDENTIFIER

SchemeParser.p_variable__IDENTIFIER(p)

variable : IDENTIFIER

SchemeParser.p_vector__HASH__L_PAREN__data__R_PAREN(p)

vector : HASH L_PAREN data R_PAREN

SchemeParser.t_BOOLEAN(t)

#(T|F|t|f)

SchemeParser.t_DECIMAL(t)
SchemeParser.t_HASH(t)

#

SchemeParser.t_HEXADECIMAL(t)
SchemeParser.t_IDENTIFIER(t)
SchemeParser.t_INTEGER(t)
SchemeParser.t_L_PAREN(t)

(

SchemeParser.t_R_PAREN(t)

)

SchemeParser.t_anything(t)

.

SchemeParser.t_error(t)
SchemeParser.t_newline(t)

n+

SchemeParser.t_quote(t)

SchemeParser.t_quote_440(t)

\[nt\’”]

SchemeParser.t_quote_443(t)

[^\”“]+

SchemeParser.t_quote_446(t)

SchemeParser.t_quote_456(t)

.

SchemeParser.t_quote_error(t)
SchemeParser.t_whitespace(t)

[ tr]+

(Parser).tokenize(input_string)

Tokenize input string and print results.

Special methods

(Parser).__call__(input_string)

Parse input_string and return result.

(AbjadObject).__eq__(expr)

Is true when ID of expr equals ID of Abjad object. Otherwise false.

Returns true or false.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to ‘’ or ‘storage’. Interprets ‘’ equal to ‘storage’.

Returns string.

(AbjadObject).__hash__()

Hashes Abjad object.

Required to be explicitly redefined on Python 3 if __eq__ changes.

Returns integer.

(AbjadObject).__ne__(expr)

Is true when Abjad object does not equal expr. Otherwise false.

Returns true or false.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.