khulnasoft's picture
Upload 26 files
ebd078b verified
raw
history blame
2.16 kB
============
Basic select
============
import javascript
select
"hello world" as foo,
"other",
"string with escaped \\ backslashes \" quotes \n\r\t whitespace",
1234,
1234.4321,
true,
false
---
(ql
(moduleMember (importDirective (importModuleExpr (moduleExpr (simpleId)))))
(moduleMember (select (asExprs
(asExpr (literal (string)) (varName (simpleId)))
(asExpr (literal (string)))
(asExpr (literal (string)))
(asExpr (literal (integer)))
(asExpr (literal (float)))
(asExpr (literal (bool (true))))
(asExpr (literal (bool (false))))))))
============
Select with variables and order by
============
from
Foo foo,
some::submodule::Bar bar,
@dbtype bar,
boolean b,
date d,
float f,
int i,
string s
select "hello world"
order by foo, bar desc, baz asc
---
(ql (moduleMember
(select
(varDecl (typeExpr (className)) (varName (simpleId)))
(varDecl (typeExpr (moduleExpr (moduleExpr (simpleId)) (simpleId)) (className)) (varName (simpleId)))
(varDecl (typeExpr (dbtype)) (varName (simpleId)))
(varDecl (typeExpr (primitiveType)) (varName (simpleId)))
(varDecl (typeExpr (primitiveType)) (varName (simpleId)))
(varDecl (typeExpr (primitiveType)) (varName (simpleId)))
(varDecl (typeExpr (primitiveType)) (varName (simpleId)))
(varDecl (typeExpr (primitiveType)) (varName (simpleId)))
(asExprs
(asExpr (literal (string))))
(orderBys
(orderBy (variable (varName (simpleId))))
(orderBy (variable (varName (simpleId))) (direction))
(orderBy (variable (varName (simpleId))) (direction))))))
========================
Annotations and comments
========================
private import foo // some other comment
/*
* Some comment
*/
pragma[noinline]
bindingset[foobar, this]
import bar
---
(ql
(moduleMember (annotation (annotName)) (importDirective (importModuleExpr (moduleExpr (simpleId)))))
(line_comment) (block_comment)
(moduleMember
(annotation (annotName) (annotArg (simpleId)))
(annotation (annotName) (annotArg (simpleId)) (annotArg (this)))
(importDirective (importModuleExpr (moduleExpr (simpleId))))))