PyZ3950/ccl
index
/home/asl2/src/PyZ2/PyZ3950/PyZ3950/ccl.py

Implements part of CCL, the Common Command Language, ISO 8777.  I'm
working from the description in the YAZ toolkit
(http://www.indexdata.dk/yaz/doc/tools.php), rather than the ISO
spec.  Two extensions:
- qualifiers can be literal "(attrtyp, attrval)" pairs, so, e.g., the
following is a legitimate for ISBN: "(1,7)=0312033095"
- the optional ATTRSET (attrset/query) which must appear at the beginning
of the string.
Allowed values are:
BIB1 (default)
XD1
UTIL
ZTHES1
EXP1
or an oid expressed as a dotted string.  (A leading dot implies a
prefix of 1.2.840.1003.3, so, e.g., .1 is the same as BIB1.)
 
Eventually I will support v3-style mixing attribute sets within
a single query, but for now I don't.

 
Modules
            
PyZ3950.asn1
lex
PyZ3950.oids
string
yacc
PyZ3950.z3950
 
Classes
            
exceptions.Exception
QuerySyntaxError
LexError
ParseError
UnimplError
Node
QuallistVal
 
class LexError(QuerySyntaxError)
       
  
Method resolution order:
LexError
QuerySyntaxError
exceptions.Exception

Data and non-method functions defined here:
__doc__ = None
__module__ = 'PyZ3950/ccl'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class Node
       
   Methods defined here:
__init__(self, type, children=None, leaf=None)
__str__(self)
str_child(self, child, depth)
str_depth(self, depth)

Data and non-method functions defined here:
__doc__ = None
__module__ = 'PyZ3950/ccl'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
 
class ParseError(QuerySyntaxError)
       
  
Method resolution order:
ParseError
QuerySyntaxError
exceptions.Exception

Data and non-method functions defined here:
__doc__ = None
__module__ = 'PyZ3950/ccl'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class QuallistVal
       
   Methods defined here:
__getitem__(self, i)
__init__(self, quallist, val)
__str__(self)

Data and non-method functions defined here:
__doc__ = None
__module__ = 'PyZ3950/ccl'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
 
class QuerySyntaxError(exceptions.Exception)
       
   Data and non-method functions defined here:
__doc__ = None
__module__ = 'PyZ3950/ccl'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
class UnimplError(QuerySyntaxError)
       
  
Method resolution order:
UnimplError
QuerySyntaxError
exceptions.Exception

Data and non-method functions defined here:
__doc__ = None
__module__ = 'PyZ3950/ccl'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.

Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)
 
Data
             __file__ = './PyZ3950/ccl.pyc'
__name__ = 'PyZ3950/ccl'
_attrdict = {'bib1': OID: 1 2 840 10003 3 1, 'exp1': OID: 1 2 840 10003 3 2, 'utility': OID: 1 2 840 10003 3 11, 'xd1': OID: 1 2 840 10003 3 12, 'zthes1': OID: 1 2 840 10003 3 13}
default_quals = ['ANY']
default_relop = '='
in_setup = 0
lexer = <lex.Lexer instance>
nested_scopes = _Feature((2, 1, 0, 'beta', 1), (2, 2, 0, 'alpha', 0), 16)
precedence = (('left', 'LOGOP'),)
qual_dict = {'AIF': (3, 3), 'ANY': (1, 1016), 'AU': (1, 1003), 'FIF': (3, 1), 'ISBN': (1, 7), 'LCCN': (1, 9), 'NOTRUNC': (5, 100), 'RTRUNC': (5, 1), 'TI': (1, 4)}
r = '>'
relop_to_attrib = {'<': 1, '<=': 2, '<>': 6, '=': 3, '>': 5, '>=': 4}
t_COMMA = ','
t_LPAREN = r'\('
t_RELOP = '(>=)|(<>)|(<=)|(=)|(<)|(>)'
t_RPAREN = r'\)'
t_SLASH = '/'
t_WORD = r"([a-z]|[A-Z]|[0-9]|&|:)([a-z]|[A-Z]|[0-9]|&|:|,|\.|')*"
t_ignore = ' \t'
tokens = ('LPAREN', 'RPAREN', 'COMMA', 'SET', 'ATTRSET', 'QUAL', 'QUOTEDVALUE', 'RELOP', 'WORD', 'LOGOP', 'SLASH')
word_init = '[a-z]|[A-Z]|[0-9]|&|:'
word_non_init = r",|\.|'"