mirror of
https://github.com/jackfoxy/urQL.git
synced 2024-12-13 22:35:53 +03:00
line comments progress2
This commit is contained in:
parent
fe9a3235c8
commit
ada2bffbef
@ -8,8 +8,18 @@
|
||||
::
|
||||
++ clip-cmnt
|
||||
|= [p=tape q=(list @) r=(list @)]
|
||||
:: |- ^- tape
|
||||
p
|
||||
|- ^- tape
|
||||
?~ q p
|
||||
|
||||
::~& "p: {<p>}"
|
||||
::~& "q: {<q>}"
|
||||
::~& "r: {<r>}"
|
||||
::~& " "
|
||||
|
||||
?: =(0 (mod (lent (skim r |=(a=@ (lth a i.q)))) 2)) :: prior --s in quotes
|
||||
(scag i.q `tape`p)
|
||||
$(q t.q)
|
||||
|
||||
|
||||
::
|
||||
:: +line-cmnts: strip line comments from tape of line
|
||||
@ -17,7 +27,6 @@ p
|
||||
++ line-cmnts
|
||||
|= p=tape
|
||||
=/ a=(list @) (fand "--" p)
|
||||
::~& "a: {<a>}"
|
||||
|- ^- tape
|
||||
?: =(0 (lent a)) p
|
||||
=/ b=(list @) (fand "'" p)
|
||||
@ -43,7 +52,11 @@ p
|
||||
?~ c
|
||||
?: =("--" (scag 2 `tape`p)) $(p ~)
|
||||
?: &(=(a 1) =("/*" (scag 2 `tape`p))) $(p ~)
|
||||
$(p ~, b (weld p b))
|
||||
?: =(0 (lent (fand "--" p))) $(p ~, b (weld p b))
|
||||
%= $
|
||||
p ~
|
||||
b (weld (line-cmnts `tape`p) b)
|
||||
==
|
||||
?: =("--" (scag 2 (slag i.c `tape`p)))
|
||||
%= $
|
||||
p (scag i.c `tape`p)
|
||||
@ -74,6 +87,7 @@ p
|
||||
|= raw-script=tape
|
||||
^- (list command:ast)
|
||||
=/ script=tape (block-cmnts raw-script)
|
||||
::~& "script: {<script>}"
|
||||
=/ commands `(list command:ast)`~
|
||||
=/ script-length (lent script)
|
||||
=/ displacement 0
|
||||
|
@ -20,80 +20,91 @@
|
||||
++ s2 ~[va-hep-hep-a vfas-tar vtar-fas vhep-hep va-fas-tar-a va-tar-fas-a]
|
||||
++ s3 ~[va-tar-fas-a va-hep-hep-a vfas-tar vtar-fas vhep-hep va-fas-tar-a]
|
||||
|
||||
++ s1a ~[vfas-tar vtar-fas]
|
||||
++ s2a ~[va-hep-hep-a vfas-tar vtar-fas]
|
||||
++ s3a ~[va-tar-fas-a va-hep-hep-a vfas-tar vtar-fas]
|
||||
|
||||
++ q1 [%query from=~ scalars=~ predicate=~ group-by=~ having=~ selection=[%select top=~ bottom=~ columns=s1] order-by=~]
|
||||
++ q2 [%query from=~ scalars=~ predicate=~ group-by=~ having=~ selection=[%select top=~ bottom=~ columns=s2] order-by=~]
|
||||
++ q3 [%query from=~ scalars=~ predicate=~ group-by=~ having=~ selection=[%select top=~ bottom=~ columns=s3] order-by=~]
|
||||
++ q3a [%query from=~ scalars=~ predicate=~ group-by=~ having=~ selection=[%select top=~ bottom=~ columns=s3a] order-by=~]
|
||||
|
||||
++ q1a [%query from=~ scalars=~ predicate=~ group-by=~ having=~ selection=[%select top=~ bottom=~ columns=s1a] order-by=~]
|
||||
++ q2a [%query from=~ scalars=~ predicate=~ group-by=~ having=~ selection=[%select top=~ bottom=~ columns=s2a] order-by=~]
|
||||
|
||||
++ t1 [%transform ctes=~ set-functions=[q1 ~ ~]]
|
||||
++ t2 [%transform ctes=~ set-functions=[q2 ~ ~]]
|
||||
++ t3 [%transform ctes=~ set-functions=[q3 ~ ~]]
|
||||
|
||||
++ t1a [%transform ctes=~ set-functions=[q1a ~ ~]]
|
||||
++ t2a [%transform ctes=~ set-functions=[q2a ~ ~]]
|
||||
++ t3a [%transform ctes=~ set-functions=[q3a ~ ~]]
|
||||
|
||||
++ test-line-cmnt-00
|
||||
%+ expect-eq
|
||||
!> ~
|
||||
!> %- parse:parse(default-database 'other-db') ~
|
||||
|
||||
++ test-line-cmnt-01
|
||||
%+ expect-eq
|
||||
!> ~
|
||||
!> %- parse:parse(default-database 'other-db') %- zing ~["--line cmnt"]
|
||||
|
||||
++ test-line-cmnt-02
|
||||
%+ expect-eq
|
||||
!> ~[[%create-namespace database-name='db1' name='ns1' as-of=~]]
|
||||
!> (parse:parse(default-database 'db1') "create namespace ns1 \0a--line cmnt")
|
||||
++ test-line-cmnt-03
|
||||
%+ expect-eq
|
||||
!> ~[[%create-namespace database-name='db1' name='ns1' as-of=~]]
|
||||
!> (parse:parse(default-database 'db1') "create namespace ns1 --line cmnt")
|
||||
|
||||
::++ test-line-cmnt-03
|
||||
:: %+ expect-eq
|
||||
:: !> ~[t1 t2 t3]
|
||||
:: !> %- parse:parse(default-database 'other-db')
|
||||
:: %- zing
|
||||
:: %- limo
|
||||
:: :~ "select '\2f\2a', '*\2f' --, ' \2f\2a ', ' *\2f ', ' -- '\0a"
|
||||
:: m-cmnt-1
|
||||
:: "select ' -- ', '\2f\2a', '*\2f', '--', ' \2f\2a ', ' *\2f '"
|
||||
:: m-cmnt-2
|
||||
:: "select ' *\2f ', ' -- ', '\2f\2a', '*\2f', '--', ' \2f\2a '"
|
||||
:: m-cmnt-3
|
||||
:: ==
|
||||
|
||||
::++ test-line-cmnt-04
|
||||
:: %+ expect-eq
|
||||
:: !> ~[t1 t2 t3]
|
||||
:: !> %- parse:parse(default-database 'other-db')
|
||||
:: %- zing
|
||||
:: %- limo
|
||||
:: :~ "select '\2f\2a', '*\2f', '--', ' \2f\2a ', ' *\2f ', ' -- '\0a"
|
||||
:: m-cmnt-1
|
||||
:: "select ' -- ', '\2f\2a', '*\2f'--, ' \2f\2a ', ' *\2f '"
|
||||
:: m-cmnt-2
|
||||
:: "select ' *\2f ', ' -- ', '\2f\2a', '*\2f', '--', ' \2f\2a '"
|
||||
:: m-cmnt-3
|
||||
:: ==
|
||||
|
||||
::++ test-line-cmnt-05
|
||||
:: %+ expect-eq
|
||||
:: !> ~[t1 t2 t3]
|
||||
:: !> %- parse:parse(default-database 'other-db')
|
||||
:: %- zing
|
||||
:: %- limo
|
||||
:: :~ "select '\2f\2a', '*\2f', '--', ' \2f\2a ', ' *\2f ', ' -- '\0a"
|
||||
:: m-cmnt-1
|
||||
:: "select ' -- ', '\2f\2a', '*\2f', '--', ' \2f\2a ', ' *\2f '"
|
||||
:: m-cmnt-2
|
||||
:: "select ' *\2f ', ' -- ', '\2f\2a', '*\2f' --, ' \2f\2a '"
|
||||
:: m-cmnt-3
|
||||
:: ==
|
||||
|
||||
::++ test-line-cmnt-06
|
||||
:: %+ expect-eq
|
||||
:: !> ~[t1 t2 t3]
|
||||
:: !> %- parse:parse(default-database 'other-db')
|
||||
:: %- zing
|
||||
:: %- limo
|
||||
:: :~ "select '\2f\2a', '*\2f', '--', ' \2f\2a-- ', ' *\2f ', ' -- '\0a"
|
||||
:: "select -- ', '\2f\2a', '*\2f'--, ' \2f\2a ', ' *\2f '"
|
||||
:: "select ' *\2f ' -- ', '\2f\2a', '*\2f', '--', ' \2f\2a '"
|
||||
++ test-line-cmnt-04
|
||||
%+ expect-eq
|
||||
!> ~[t1a t2 t3]
|
||||
!> %- parse:parse(default-database 'other-db')
|
||||
%- zing
|
||||
%- limo
|
||||
:~ "select '\2f\2a', '*\2f' --, ' \2f\2a ', ' *\2f ', ' -- '\0a"
|
||||
m-cmnt-1
|
||||
"select ' -- ', '\2f\2a', '*\2f', '--', ' \2f\2a ', ' *\2f '"
|
||||
m-cmnt-2
|
||||
"select ' *\2f ', ' -- ', '\2f\2a', '*\2f', '--', ' \2f\2a '"
|
||||
m-cmnt-3
|
||||
==
|
||||
++ test-line-cmnt-05
|
||||
%+ expect-eq
|
||||
!> ~[t1 t2a t3]
|
||||
!> %- parse:parse(default-database 'other-db')
|
||||
%- zing
|
||||
%- limo
|
||||
:~ "select '\2f\2a', '*\2f', '--', ' \2f\2a ', ' *\2f ', ' -- '\0a"
|
||||
m-cmnt-1
|
||||
"select ' -- ', '\2f\2a', '*\2f'--, ' \2f\2a ', ' *\2f '"
|
||||
m-cmnt-2
|
||||
"select ' *\2f ', ' -- ', '\2f\2a', '*\2f', '--', ' \2f\2a '"
|
||||
m-cmnt-3
|
||||
==
|
||||
++ test-line-cmnt-06
|
||||
%+ expect-eq
|
||||
!> ~[t1 t2 t3a]
|
||||
!> %- parse:parse(default-database 'other-db')
|
||||
%- zing
|
||||
%- limo
|
||||
:~ "select '\2f\2a', '*\2f', '--', ' \2f\2a ', ' *\2f ', ' -- '\0a"
|
||||
m-cmnt-1
|
||||
"select ' -- ', '\2f\2a', '*\2f', '--', ' \2f\2a ', ' *\2f '"
|
||||
m-cmnt-2
|
||||
"select ' *\2f ', ' -- ', '\2f\2a', '*\2f' --, ' \2f\2a '"
|
||||
m-cmnt-3
|
||||
==
|
||||
++ test-line-cmnt-07
|
||||
%+ expect-eq
|
||||
!> ~[t1a t2a t3a]
|
||||
!> %- parse:parse(default-database 'other-db')
|
||||
%- zing
|
||||
%- limo
|
||||
:~ "select '\2f\2a', '*\2f', '--', ' \2f\2a-- ', ' *\2f ', ' -- '\0a"
|
||||
"select ' -- ', '\2f\2a', '*\2f'--, ' \2f\2a ', ' *\2f '"
|
||||
"select ' *\2f ' -- ', '\2f\2a', '*\2f', '--', ' \2f\2a '"
|
||||
==
|
||||
|
||||
|
||||
::@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
|
Loading…
Reference in New Issue
Block a user