Parser
cifflow.parser.version
CIF version detection.
Scans the beginning of a CIF source string to identify the version magic line, returning the detected version, the remaining source after the magic line is consumed, the line offset (how many lines were consumed), and any errors.
Must be called before the lexer is instantiated.
detect_version(source)
Detect the CIF version from source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str
|
Full CIF source string to inspect. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[CifVersion, str, int, List[ParseError]]
|
|
Source code in src/cifflow/parser/version.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |