1 """
2 Parsing, annotating, and morphing queries in the Astronomical Data
3 Query Language.
4 """
5
6
7
8
9
10
11
12
13
14 from gavo.adql.annotations import annotate
15
16 from gavo.adql.common import *
17
18 from gavo.adql.tree import (
19 getTreeBuildingGrammar, registerNode)
20
21 from gavo.adql.nodes import flatten
22
23 from gavo.adql.grammar import (
24 getADQLGrammar as getRawGrammar,
25 allReservedWords,
26 ParseException, ParseSyntaxException)
27
28 from gavo.adql.morphpg import (
29 morphPG)
30
31 from gavo.adql.fieldinfo import getSubsumingType, FieldInfo
32
33 from gavo.adql.ufunctions import userFunction
34
35 from gavo.adql.postproc import builtinMorph
36
37
40
43
45 """returns a "naked" parse tree for adqlStatement.
46
47 It contains no annotations, so you'll usually not want to use this.
48 """
49 return utils.pyparseString(getGrammar(), adqlStatement)[0]
50
52 """returns a tuple of context, parsedTree for parsing and annotating
53 adqlStatement.
54
55 The builtin morphs are performed on the tree.
56 """
57 parsedTree = parseToTree(adqlStatement)
58 ctx = annotate(parsedTree, fieldInfoGetter)
59 return ctx, builtinMorph(parsedTree)[1]
60