├── .gitignore ├── goto-def.png ├── tests ├── cases │ ├── number.txt │ ├── tag.txt │ ├── rstring.txt │ ├── block.txt │ ├── mstring.txt │ ├── string.txt │ ├── binary.txt │ ├── map.txt │ ├── char.txt │ ├── path.txt │ └── mixure.red ├── ast-cases.red ├── ast-lines.red ├── ast-lines.txt └── ast-cases.txt ├── README.md ├── highlight.red ├── lsp-const.red ├── LICENSE ├── system-words.red ├── lexer.red └── server.red /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | logger\.txt 3 | logger\.bak 4 | red\.exe 5 | -------------------------------------------------------------------------------- /goto-def.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitbegin/redlangserver/HEAD/goto-def.png -------------------------------------------------------------------------------- /tests/cases/number.txt: -------------------------------------------------------------------------------- 1 | 123 2 | 123abc 3 | 123.0 4 | 123e3 5 | .123e-3 6 | +123e+3 7 | -------------------------------------------------------------------------------- /tests/cases/tag.txt: -------------------------------------------------------------------------------- 1 | 2 | 4 | > 5 | < 6 | " 7 | "test ^(unknown)" 8 | "with 9 | newline" 10 | -------------------------------------------------------------------------------- /tests/cases/binary.txt: -------------------------------------------------------------------------------- 1 | #{1234 5678} 2 | #{1234 3 | 5678} 4 | #{EEFF GGHH} 5 | #{01 02 03 0 4} 6 | #{1FF} 7 | 2#{01010101} 8 | 2#{0102} 9 | 16#{cdef} 10 | 16#{efgh} 11 | 64#{YQ==} 12 | 64#{AA} 13 | #{01FF}} 14 | #{01FF 15 | -------------------------------------------------------------------------------- /tests/cases/map.txt: -------------------------------------------------------------------------------- 1 | 2 | #(this is a map!) 3 | #(([])) 4 | [(#())] 5 | #(#(#())) 6 | 7 | #( 8 | a: #( 9 | b: ( 10 | c: [ 11 | d: {string!} 12 | ] 13 | ) 14 | ) 15 | ) 16 | 17 | [#())] 18 | [#(#()] 19 | #([) 20 | #(]) 21 | #( 22 | map! -------------------------------------------------------------------------------- /tests/cases/char.txt: -------------------------------------------------------------------------------- 1 | #"" 2 | #"^(30)" 3 | #"^(3132)" 4 | #"^(313233)" 5 | #"^(31323334)" 6 | #"^(3132333435)" 7 | #"^(313233343536)" 8 | #"^(31323334353637)" 9 | #"^(line)" 10 | #"^(unknown)" 11 | #"abc" 12 | #"^^(line)" 13 | #"^(31) 14 | a" 15 | #"a 16 | some token 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # redlangserver 2 | 3 | A `Red language` server written in `Red` for [lsp](https://langserver.org/). 4 | 5 | It's a submodule for [red/VScode-extension](https://github.com/red/VScode-extension). 6 | 7 | ## Features 8 | 9 | * hint all syntax errors 10 | * auto completion 11 | * goto definition 12 | * hover to view signatures 13 | -------------------------------------------------------------------------------- /tests/cases/path.txt: -------------------------------------------------------------------------------- 1 | a/b/c 2 | 'a/bc/def 3 | :abc/de/f 4 | abc/def/ghi: 5 | a^b/c^^d/e^^^f 6 | a/b/(var) 7 | a/b/(1 + 2) 8 | a/b/(1 + 2): 9 | :a/b/(1 + 2) 10 | 'a/b/(1 + 2) 11 | a/b/(var)/1 12 | a/b/(a + b/(c [e f])) 13 | a/b/2.34 14 | a/'b 15 | a/:b 16 | 17 | a/b/[] 18 | a/b/ 19 | 'a/bc/ 20 | :abc/de/ 21 | abc/def/: 22 | a/b/c:d 23 | a/b/1:2 24 | abc/def/' 25 | -------------------------------------------------------------------------------- /tests/ast-cases.red: -------------------------------------------------------------------------------- 1 | Red [] 2 | 3 | #include %../lexer.red 4 | 5 | ;-- usage: 6 | ;-- ./console ast-cases.red 7 | 8 | output: %ast-cases.txt 9 | write output mold now 10 | write/append output "^/" 11 | 12 | files: read %cases/ 13 | 14 | forall files [ 15 | src: read rejoin [%cases/ files/1] 16 | write/append output rejoin ["begin " mold files/1 "^/"] 17 | write/append output "================================================^/" 18 | write/append output lexer/format lexer/transcode src 19 | write/append output "^/" 20 | write/append output "================================================^/" 21 | write/append output rejoin ["end " mold files/1 "^/"] 22 | write/append output "^/" 23 | ] 24 | -------------------------------------------------------------------------------- /highlight.red: -------------------------------------------------------------------------------- 1 | Red [] 2 | #include %system-words.red 3 | 4 | to-regex: func [words [block!]][ 5 | result: clear "" 6 | append result "(" 7 | forall words [ 8 | str: to string! words/1 9 | replace/all str "\" "\\\\" 10 | replace/all str "?" "\\?" 11 | replace/all str "*" "\\*" 12 | replace/all str "." "\\." 13 | replace/all str "+" "\\+" 14 | replace/all str "|" "\\|" 15 | replace/all str "$" "\\$" 16 | replace/all str "^^" "\\^^" 17 | append result str 18 | append result "|" 19 | ] 20 | remove back tail result 21 | append result ")" 22 | ] 23 | 24 | print "Red words: " 25 | print to-regex system-words/get-words no 26 | print "Red/System words: " 27 | print to-regex system-words/get-words yes 28 | -------------------------------------------------------------------------------- /lsp-const.red: -------------------------------------------------------------------------------- 1 | Red [ 2 | Title: "lsp Constant" 3 | Author: "bitbegin" 4 | File: %lsp-const.red 5 | Tabs: 4 6 | Rights: "Copyright (C) 2011-2019 Red Foundation. All rights reserved." 7 | License: "BSD-3 - https://github.com/red/red/blob/origin/BSD-3-License.txt" 8 | ] 9 | 10 | CompletionItemKind: [ 11 | Text 1 12 | Method 2 13 | Function 3 14 | Constructor 4 15 | Field 5 16 | Variable 6 17 | Class 7 18 | Interface 8 19 | Module 9 20 | Property 10 21 | Unit 11 22 | Value 12 23 | Enum 13 24 | Keyword 14 25 | Snippet 15 26 | Color 16 27 | File 17 28 | Reference 18 29 | Folder 19 30 | EnumMember 20 31 | Constant 21 32 | Struct 22 33 | Event 23 34 | Operator 24 35 | TypeParameter 25 36 | ] 37 | 38 | SymbolKind: [ 39 | File 1 40 | Module 2 41 | Namespace 3 42 | Package 4 43 | Class 5 44 | Method 6 45 | Property 7 46 | Field 8 47 | Constructor 9 48 | Enum 10 49 | Interface 11 50 | Function 12 51 | Variable 13 52 | Constant 14 53 | String 15 54 | Number 16 55 | Boolean 17 56 | Array 18 57 | Object 19 58 | Key 20 59 | Null 21 60 | EnumMember 22 61 | Struct 23 62 | Event 24 63 | Operator 25 64 | TypeParameter 26 65 | ] 66 | 67 | DiagnosticSeverity: [ 68 | Error 1 69 | Warning 2 70 | Information 3 71 | Hint 4 72 | ] -------------------------------------------------------------------------------- /tests/cases/mixure.red: -------------------------------------------------------------------------------- 1 | Red he: [] 2 | 3 | a: 'test 4 | b: context [ 5 | a: a 6 | c: 4 7 | d: context [ 8 | e: #{12} 9 | f: func [x [block!] y [integer!]][ 10 | ff: function [a [integer!] b [binary!]][ 11 | f1: "test" 12 | f2: x 13 | f3: f1 14 | f4: l 15 | f5: :f 16 | f6: f5 17 | f7: a + length? b 18 | f 19 | ] 20 | x: 1 21 | y: 1 22 | e: x + y 23 | o: g 24 | t: h 25 | u: x 26 | ] 27 | g: [] 28 | ] 29 | h: #(a: 3) 30 | i: x 31 | j: e 32 | k: t 33 | ] 34 | 35 | l: (m: 3 n: a) 36 | o: l 37 | 38 | r: func [ 39 | a [test] 40 | b [test!] 41 | /part length [integer! string!] 42 | return: [block!] ;--tests 43 | /local x y 44 | ][ 45 | if part [length] 46 | x: 1 y: 1 47 | a + b + 1 + 1 48 | ] 49 | 50 | s: function [uri [string!] code [string!] blk [block!]][ 51 | either uri [ 52 | return reduce [uri code blk] 53 | ][ 54 | return reduce [uri code blk] 55 | ] 56 | ] 57 | 58 | fff: 3 59 | 60 | ft: func [a [block!] b [map! integer!] return: [integer!] c [integer!] /c a [integer!] /d /local x y z][ 61 | reduce [a b c d] 62 | find/match "adb" "a" 63 | ] 64 | 65 | fh1: has [/ref a b] 66 | fh2: has [a b][] 67 | 68 | z: z 69 | 70 | blk: [a: 1] 71 | ctx: context [ 72 | a: none 73 | ] 74 | 75 | do bind blk ctx 76 | 77 | if all tt: [a = 1 integer? a][print 3] 78 | -------------------------------------------------------------------------------- /tests/ast-lines.red: -------------------------------------------------------------------------------- 1 | Red [] 2 | 3 | #include %../lexer.red 4 | 5 | ;-- usage: 6 | ;-- ./console ast-lines.red 7 | 8 | output: %ast-lines.txt 9 | write output mold now 10 | write/append output "^/" 11 | 12 | codes: [ 13 | ;-- char! 14 | %{"}% 15 | %{#"^(00)"}% 16 | %{#"^(00)}% 17 | %{#"^(00) a"}% 18 | ;-- line string! 19 | %{"abc"}% 20 | %{"abc}% 21 | %{"abc 22 | "}% 23 | ;-- block! 24 | "[]" 25 | "[" 26 | "]" 27 | "[][" 28 | "[]]" 29 | "[[]" 30 | "][]" 31 | "[[]]" 32 | ;-- paren! 33 | "()" 34 | "(" 35 | ")" 36 | "()(" 37 | "())" 38 | "(()" 39 | ")()" 40 | "(())" 41 | ;-- multi string! 42 | "{}" 43 | "{" 44 | "}" 45 | "{}{" 46 | "{}}" 47 | "{{}" 48 | "}{}" 49 | "{{}}" 50 | "{{" 51 | "{{{" 52 | ;-- path! 53 | "a/" 54 | "a/ " 55 | "a/b" 56 | "a/b/" 57 | "'a/b/" 58 | ":a/b/" 59 | "a/b/ " 60 | "a/b/:" 61 | "a/b/: " 62 | "a/b/'" 63 | "a/b/' " 64 | "a/b/[" 65 | %{a/"b}% 66 | %{a/"b }% 67 | %{a/"b"c}% 68 | %{a/"b"^/}% 69 | ;-- comment! 70 | "abc;--comment" 71 | "abc;--comment^/" 72 | "abc;--comment^/efg" 73 | ";--comment^/abc" 74 | "[;--comment^/]" 75 | "(;--comment^/)" 76 | "a/b;--comment^/" 77 | "a/;--comment^/" 78 | ] 79 | 80 | forall codes [ 81 | write/append output rejoin ["begin " mold codes/1 "^/"] 82 | write/append output "================================================^/" 83 | write/append output lexer/format lexer/transcode codes/1 84 | write/append output "================================================^/" 85 | write/append output rejoin ["end " mold codes/1 "^/"] 86 | write/append output "^/" 87 | ] 88 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2018, 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /system-words.red: -------------------------------------------------------------------------------- 1 | Red [ 2 | Title: "Red system-words for Red language server" 3 | Author: "bitbegin" 4 | File: %system-words.red 5 | Tabs: 4 6 | Rights: "Copyright (C) 2011-2019 Red Foundation. All rights reserved." 7 | License: "BSD-3 - https://github.com/red/red/blob/origin/BSD-3-License.txt" 8 | ] 9 | 10 | system-words: context [ 11 | get-red-words: has [sys words] [ 12 | sys: words-of system/words 13 | words: make block! length? sys 14 | forall sys [ 15 | if value? sys/1 [ 16 | append words sys/1 17 | ] 18 | ] 19 | words 20 | ] 21 | red-words: get-red-words 22 | reds-words: [?? as assert size? if either case switch until while loop any all exit return break continue catch declare use null context with comment true false func function alias] 23 | get-words: func [system? [logic!]][ 24 | either system? [reds-words][red-words] 25 | ] 26 | keyword?: func [system? [logic!] word [word!]][ 27 | to logic! find either system? [reds-words][red-words] word 28 | ] 29 | 30 | get-word-info: func [system? [logic!] word [word!]][ 31 | if system? [return none] 32 | either find red-words word [ 33 | help-string :word 34 | ][none] 35 | ] 36 | 37 | get-path-info: func [system? [logic!] path [path!]][ 38 | if system? [return none] 39 | either find red-words path/1 [ 40 | n: copy path 41 | while [ 42 | all [ 43 | not tail? n 44 | error? ret: try [ 45 | either 1 = length? n [ 46 | n2: to word! n/1 47 | help-string :n2 48 | ][ 49 | help-string :n 50 | ] 51 | ] 52 | ] 53 | ][ 54 | remove back tail n 55 | ] 56 | if error? ret [return none] 57 | ret 58 | ][ 59 | none 60 | ] 61 | ] 62 | 63 | func-spec-ctx: context [ 64 | func-spec: context [ 65 | desc: none ; string! desc 66 | attr: none ; block! [attr ...] 67 | params: copy [] ; [word! opt block! opt string!] [name type desc] 68 | refinements: copy [] ; [word! opt string! [params]] [name desc [[name type desc] ...]] 69 | locals: copy [] ; [some word!] [name ...] 70 | returns: copy [] ; [opt [word! string!]] [type desc] 71 | ] 72 | 73 | param-frame-proto: reduce ['name none 'type none 'desc none] 74 | refinement-frame-proto: reduce ['name none 'desc none 'params copy []] 75 | 76 | ;!! These cause problems if local in parse-func-spec 77 | stack: copy [] 78 | push: func [val][append/only stack val] 79 | pop: does [also take back tail stack cur-frame: last stack] 80 | push-param-frame: does [ 81 | push cur-frame: copy param-frame-proto 82 | ] 83 | push-refinement-frame: does [ 84 | push cur-frame: copy/deep refinement-frame-proto 85 | ] 86 | emit: function [key val][ 87 | pos: find/only/skip cur-frame key 2 88 | head change/only next pos val 89 | ] 90 | ;!! 91 | 92 | parse-func-spec: function [ 93 | "Parses a function spec and returns an object model of it." 94 | spec [block! any-function!] 95 | /local =val ; set with parse, so function won't collect it 96 | ][ 97 | clear stack 98 | ; The = sigils are just to make parse-related vars more obvious 99 | func-desc=: [set =val string! (res/desc: =val)] 100 | attr-val=: ['catch | 'throw] 101 | func-attr=: [into [copy =val some attr-val= (res/attr: =val)]] 102 | 103 | param-name=: [ 104 | set =val [word! | get-word! | lit-word!] 105 | (push-param-frame emit 'name =val) 106 | ] 107 | ;!! This isn't complete. Under R2 we could parse for datatype! in 108 | ; the param type spec, but they are just words in Red func specs. 109 | param-type=: [set =val block! (emit 'type =val)] 110 | param-desc=: [set =val string! (emit 'desc =val)] 111 | param-attr=: [opt param-type= opt param-desc=] 112 | param=: [param-name= param-attr= (append/only res/params new-line/all pop off)] 113 | 114 | ref-name=: [set =val refinement! (push-refinement-frame emit 'name =val)] 115 | ref-desc=: :param-desc= 116 | ref-param=: [param-name= param-attr= (tmp: pop append/only cur-frame/params tmp)] 117 | refinement=: [ref-name= opt ref-desc= any ref-param= (append/only res/refinements pop)] 118 | local-name=: [set =val word! (push-param-frame emit 'name =val)] 119 | local-param=: [local-name= param-attr= (append/only res/locals new-line/all pop off)] 120 | locals=: [/local any local-param=] 121 | returns=: [ 122 | quote return: (push-param-frame emit 'name 'return) 123 | param-type= opt param-desc= 124 | (res/returns: pop) 125 | ] 126 | spec=: [ 127 | opt func-desc= 128 | opt func-attr= 129 | any param= 130 | any [locals= to end | refinement= | returns=] 131 | ] 132 | 133 | if any-function? :spec [spec: spec-of :spec] 134 | res: make func-spec [] 135 | either parse spec spec= [res] [none] 136 | ] 137 | ] 138 | 139 | ;-- for speed up 140 | func-spec: func-spec-ctx/parse-func-spec get 'func 141 | has-spec: func-spec-ctx/parse-func-spec get 'has 142 | does-spec: func-spec-ctx/parse-func-spec get 'does 143 | function-spec: func-spec-ctx/parse-func-spec get 'function 144 | context-spec: func-spec-ctx/parse-func-spec get 'context 145 | do-spec: func-spec-ctx/parse-func-spec get 'do 146 | bind-spec: func-spec-ctx/parse-func-spec get 'bind 147 | all-spec: func-spec-ctx/parse-func-spec get 'all 148 | any-spec: func-spec-ctx/parse-func-spec get 'any 149 | 150 | get-spec: function [word [word!]][ 151 | if find [func has does function context do bind all any] word [ 152 | spec: to word! append to string! word "-spec" 153 | return do bind spec system/words/system-words 154 | ] 155 | either find [native! action! op! function! routine!] type?/word get word [ 156 | func-spec-ctx/parse-func-spec get word 157 | ][none] 158 | ] 159 | 160 | ] 161 | -------------------------------------------------------------------------------- /lexer.red: -------------------------------------------------------------------------------- 1 | Red [ 2 | Title: "Red runtime lexer" 3 | Author: "bitbegin" 4 | File: %lexer.red 5 | Tabs: 4 6 | Rights: "Copyright (C) 2020 Red Foundation. All rights reserved." 7 | ] 8 | 9 | lexer: context [ 10 | all-path!: reduce [path! lit-path! get-path! set-path!] 11 | noset-path!: reduce [path! lit-path! get-path!] 12 | all-pair!: reduce [block! paren! map!] 13 | pre-path!: reduce [lit-path! get-path!] 14 | 15 | uri-to-file: function [uri [string!] return: [file!]][ 16 | src: copy find/tail uri "file:///" 17 | to-red-file dehex src 18 | ] 19 | file-to-uri: function [file [file!] return: [string!]][ 20 | src: to-local-file file 21 | replace/all src "\" "/" 22 | insert src "file:///" 23 | src 24 | ] 25 | parse-line: function [stack [block!] src [string!]][ 26 | append stack src 27 | append stack index? src 28 | while [src: find/tail src #"^/"][ 29 | append stack index? src 30 | ] 31 | ] 32 | line-pos?: function [stack [block!] line [integer!] column [integer!] return: [string!]][ 33 | pos: pick stack line + 1 34 | skip at stack/1 pos column - 1 35 | ] 36 | index-line?: function [stack [block!] pos [integer!] return: [pair!]][ 37 | stack: next stack 38 | forall stack [ 39 | if all [ 40 | stack/1 <= pos 41 | any [ 42 | none? stack/2 43 | stack/2 > pos 44 | ] 45 | ][ 46 | column: pos - stack/1 47 | return as-pair (index? stack) - 1 column + 1 48 | ] 49 | ] 50 | none 51 | ] 52 | pos-line?: function [stack [block!] pos [string!] return: [pair!]][ 53 | index-line? stack index? pos 54 | ] 55 | pos-range?: function [stack [block!] s [string!] e [string!] return: [block!]][ 56 | range: make block! 4 57 | append range pos-line? stack s 58 | append range pos-line? stack e 59 | range 60 | ] 61 | ;-- Range in lsp is zero-based position, use /keep for print 62 | form-range: function [range [block!] return: [map!] /keep][ 63 | make map! reduce [ 64 | 'start make map! reduce [ 65 | 'line either keep [range/1/x][range/1/x - 1] 66 | 'character either keep [range/1/y][range/1/y - 1] 67 | ] 68 | 'end make map! reduce [ 69 | 'line either keep [range/2/x][range/2/x - 1] 70 | 'character either keep [range/2/y][range/2/y - 1] 71 | ] 72 | ] 73 | ] 74 | load-range: function [stack [block!] range [block!]][ 75 | start: line-pos? stack range/1/x range/1/y 76 | stop: line-pos? stack range/2/x range/2/y 77 | try [load copy/part start stop] 78 | ] 79 | 80 | remove-last-empty-nested: func [ 81 | item [block!] 82 | ][ 83 | if all [ 84 | item/nested 85 | empty? item/nested 86 | ][ 87 | item/nested: none 88 | ] 89 | ] 90 | 91 | insert-node: function [ 92 | stack [block!] 93 | lines [block!] 94 | src [string!] 95 | return: [block!] 96 | ][ 97 | add-node: func [ 98 | x [integer!] 99 | y [integer!] 100 | type [datatype! word!] 101 | expr 102 | error 103 | /local nested 104 | ][ 105 | nested: select last stack 'nested 106 | repend/only nested [ 107 | 'range reduce [index-line? lines x index-line? lines y] 108 | 'type type 109 | 'upper back tail stack 110 | ] 111 | if expr [ 112 | repend last nested ['expr reduce [expr]] 113 | ] 114 | if error [ 115 | repend last nested ['error error] 116 | ] 117 | ] 118 | push-node: func [ 119 | x [integer!] 120 | type [datatype!] 121 | return: [block!] 122 | /local nested 123 | ][ 124 | nested: select last stack 'nested 125 | repend/only nested [ 126 | 'range reduce [index-line? lines x] 127 | 'type type 128 | 'upper back tail stack 129 | ] 130 | repend last nested ['nested reduce []] 131 | stack: nested 132 | ] 133 | lex: func [ 134 | event [word!] 135 | input [string! binary!] 136 | type [datatype! word! none!] 137 | line [integer!] 138 | token 139 | return: [logic!] 140 | /local ltype x y err str 141 | ][ 142 | [prescan scan load open close error] 143 | close-path: func [ 144 | y [integer!] 145 | err [block!] 146 | /local item 147 | ][ 148 | item: last stack 149 | append item/range index-line? lines y 150 | repend item ['error err] 151 | stack: item/upper 152 | ] 153 | match-pair: func [ 154 | x [integer!] 155 | y [integer!] 156 | /local ltype item nstop 157 | ][ 158 | forever [ 159 | unless ltype: select last stack 'type [ ;-- check if top 160 | add-node x y type none [code only-closed] 161 | break 162 | ] 163 | unless nstop [ 164 | nstop: index-line? lines y 165 | ] 166 | if any [ ;-- match the upper's type 167 | ltype = type 168 | all [ 169 | find noset-path! ltype 170 | type = set-path! 171 | ] 172 | all [ 173 | ltype = map! 174 | type = paren! 175 | ] 176 | ][ 177 | item: last stack 178 | if type = set-path! [ 179 | item/type: type 180 | ] 181 | append item/range nstop 182 | remove-last-empty-nested item 183 | stack: item/upper 184 | break 185 | ] 186 | item: last stack 187 | append item/range nstop 188 | repend item ['error [code only-opened]] 189 | remove-last-empty-nested item 190 | stack: item/upper 191 | ] 192 | ] 193 | 194 | in-path?: func [ 195 | /local p? ltype 196 | ][ 197 | p?: no 198 | if all [ 199 | ltype: select last stack 'type 200 | ltype 201 | ][ 202 | if find noset-path! ltype [ 203 | p?: yes 204 | ] 205 | ] 206 | p? 207 | ] 208 | 209 | ;print [event mold type token mold input] 210 | switch event [ 211 | prescan [ 212 | pretoken: token 213 | if all [ 214 | type = 'eof 215 | input/1 = #";" 216 | ][ 217 | add-node token/x token/y 'comment none none 218 | ] 219 | true 220 | ] 221 | scan [ 222 | stoken: either all [start stop][ ;-- string! need adjust the position 223 | as-pair start stop 224 | ][token] 225 | stype: type 226 | if stype = 'comment [ 227 | add-node stoken/x stoken/y stype none none 228 | ] 229 | true 230 | ] 231 | load [ 232 | add-node stoken/x stoken/y stype token none 233 | start: stop: none stoken: none 234 | true 235 | ] 236 | open [ 237 | either type = string! [ 238 | if none? start [ 239 | start: token/x 240 | ] 241 | ][ 242 | push-node token/x type 243 | ] 244 | true 245 | ] 246 | close [ 247 | either type = string! [ 248 | stop: token/y + 1 249 | ][ 250 | nstop: none 251 | x: token/x 252 | either find noset-path! type [ 253 | y: token/y 254 | ][ 255 | switch input/1 [ 256 | #")" [type: paren!] 257 | #"]" [type: block!] 258 | #"}" [type: string!] 259 | ] 260 | y: token/y + 1 261 | input: next input 262 | ] 263 | close-y: token/y 264 | match-pair x y 265 | ] 266 | true 267 | ] 268 | error [ 269 | case [ 270 | find noset-path! type [ 271 | case [ 272 | input/1 = #"/" [ ;-- eof after / 273 | y: token/y + 1 274 | input: next input 275 | err: [code slash] 276 | ] 277 | input/-1 = #"/" [ ;-- slash 278 | y: token/y 279 | err: [code slash] 280 | ] 281 | true [ 282 | y: token/y + 1 283 | input: next input 284 | err: [code unknown] 285 | ] 286 | ] 287 | close-path y err 288 | ] 289 | find all-pair! type [ 290 | if all [ 291 | token/y > close-y 292 | find ")]}" input/1 293 | ][ 294 | switch input/1 [ 295 | #")" [type: paren!] 296 | #"]" [type: block!] 297 | #"}" [type: string!] 298 | ] 299 | match-pair token/x token/y + 1 300 | ] 301 | input: next input 302 | ] 303 | in-path? [ 304 | s: skip input token/x - token/y 305 | err: reduce ['code type 'expr copy/part s input] 306 | close-path token/y err 307 | ] 308 | type = string! [ 309 | ;-- multiline 310 | either start [ 311 | x: start 312 | y: token/y 313 | input: next input 314 | ][ 315 | ;-- have scaned 316 | either stoken [ 317 | x: pretoken/x 318 | y: pretoken/y + 1 319 | input: next input 320 | ][ 321 | either input/1 = #"^"" [ 322 | x: pretoken/x 323 | y: pretoken/y + 1 324 | input: next input 325 | ][ 326 | x: pretoken/x 327 | y: pretoken/y 328 | ] 329 | ] 330 | ] 331 | stoken: none 332 | err: reduce ['code 'only-opened 'at token/x - x] 333 | add-node x y type none err 334 | ] 335 | type = error! [ 336 | either input/1 = #"}" [ 337 | type: string! 338 | err: [code only-closed] 339 | ][ 340 | err: [code only-opened] 341 | ] 342 | input: next input 343 | add-node token/x token/y + 1 type none err 344 | ] 345 | type = char! [ 346 | either input/1 = #"^"" [ 347 | y: token/y + 1 348 | input: next input 349 | err: [code invalid] 350 | ][ 351 | y: token/y 352 | err: [code not-closed] 353 | ] 354 | add-node token/x y type none err 355 | ] 356 | type = binary! [ 357 | either input/1 = #"}" [ 358 | y: token/y + 1 359 | input: next input 360 | err: [code invalid] 361 | ][ 362 | y: token/y 363 | err: [code not-closed] 364 | ] 365 | add-node token/x y type none err 366 | ] 367 | true [ 368 | add-node token/x token/y type none [code unknown] 369 | ] 370 | ] 371 | false 372 | ] 373 | ] 374 | ] 375 | 376 | top: stack 377 | 378 | pretoken: none ;-- used for store prescan token 379 | start: none ;-- used for mark the begin of string! 380 | stop: none ;-- used for mark the end of string! 381 | stoken: none ;-- used for store scan token 382 | stype: none ;-- used for store scan type 383 | close-y: 0 384 | system/words/transcode/trace src :lex 385 | 386 | stop: none 387 | while [stack <> top][ 388 | unless stop [ 389 | stop: index-line? lines index? tail src 390 | ] 391 | item: last stack 392 | append item/range stop 393 | either item/error [ 394 | item/error/code: 'only-opened 395 | ][ 396 | append item [error [code only-opened]] 397 | ] 398 | remove-last-empty-nested item 399 | stack: item/upper 400 | ] 401 | top 402 | ] 403 | 404 | transcode: function [ 405 | src [string!] 406 | return: [block!] 407 | ][ 408 | unless head? src [return none] 409 | lines: make block! 64 410 | parse-line lines src 411 | range: make block! 1 412 | append range 1x1 413 | append range pos-line? lines tail src 414 | stack: reduce [reduce ['source src 'lines lines 'range range 'nested reduce []]] 415 | top: stack 416 | insert-node stack lines src 417 | if empty? top/1/nested [ 418 | top/1/nested: none 419 | ] 420 | top 421 | ] 422 | 423 | format: function [top [block!]][ 424 | buffer: make string! 1000 425 | newline: function [cnt [integer!]] [ 426 | append buffer lf 427 | append/dup buffer " " cnt 428 | ] 429 | 430 | format*: function [pc [block!] depth [integer!]][ 431 | pad: depth * 4 432 | newline pad 433 | append buffer "[" 434 | forall pc [ 435 | newline pad + 2 436 | append buffer "[" 437 | if pc/1/expr [ 438 | newline pad + 4 439 | append buffer "expr: " 440 | append buffer mold/flat/part pc/1/expr/1 20 441 | ] 442 | if pc/1/range [ 443 | newline pad + 4 444 | append buffer "range: " 445 | append buffer mold/flat pc/1/range 446 | ] 447 | if pc/1/type [ 448 | newline pad + 4 449 | append buffer "type: " 450 | append buffer mold/flat pc/1/type 451 | ] 452 | if pc/1/nested [ 453 | newline pad + 4 454 | append buffer "nested: " 455 | format* pc/1/nested depth + 1 456 | ] 457 | if pc/1/source [ 458 | newline pad + 4 459 | append buffer "source: " 460 | append buffer mold/flat/part pc/1/source 10 461 | ] 462 | if lines: pc/1/lines [ 463 | newline pad + 4 464 | append buffer "lines: [" 465 | newline pad + 6 466 | append buffer mold/flat/part lines/1 10 467 | lines: next lines 468 | forall lines [ 469 | newline pad + 6 470 | append buffer mold lines/1 471 | ] 472 | newline pad + 4 473 | append buffer "]" 474 | ] 475 | if upper: pc/1/upper [ 476 | newline pad + 4 477 | append buffer "upper: " 478 | append buffer mold/flat upper/1/range 479 | ] 480 | if error: pc/1/error [ 481 | newline pad + 4 482 | append buffer "error: " 483 | append buffer mold/flat/part error 30 484 | ] 485 | newline pad + 2 486 | append buffer "]" 487 | ] 488 | newline pad 489 | append buffer "]" 490 | ] 491 | format* top 0 492 | buffer 493 | ] 494 | 495 | sformat: function [top [block!]][ 496 | buffer: make string! 1000 497 | newline: function [cnt [integer!]] [ 498 | append buffer lf 499 | append/dup buffer " " cnt 500 | ] 501 | format*: function [pc [block!] depth [integer!]][ 502 | pad: depth * 4 503 | newline pad 504 | append buffer "[" 505 | forall pc [ 506 | newline pad + 2 507 | append buffer "[" 508 | append buffer "range: " 509 | append buffer mold/flat pc/1/range 510 | if upper: pc/1/upper [ 511 | append buffer " upper: " 512 | append buffer mold/flat upper/1/range 513 | ] 514 | if pc/1/type [ 515 | append buffer " type: " 516 | append buffer mold/flat pc/1/type 517 | ] 518 | if pc/1/expr [ 519 | append buffer " expr: " 520 | append buffer mold/flat/part pc/1/expr/1 20 521 | ] 522 | if error: pc/1/error [ 523 | append buffer " error: " 524 | append buffer mold/flat/part error 30 525 | ] 526 | if pc/1/nested [ 527 | append buffer " nested: " 528 | format* pc/1/nested depth + 1 529 | ] 530 | append buffer "]" 531 | ] 532 | newline pad 533 | append buffer "]" 534 | ] 535 | format* top 0 536 | buffer 537 | ] 538 | ] 539 | -------------------------------------------------------------------------------- /server.red: -------------------------------------------------------------------------------- 1 | Red [ 2 | Title: "Red server for Visual Studio Code" 3 | Author: "bitbegin" 4 | File: %server.red 5 | Tabs: 4 6 | Rights: "Copyright (C) 2011-2019 Red Foundation. All rights reserved." 7 | License: "BSD-3 - https://github.com/red/red/blob/origin/BSD-3-License.txt" 8 | ] 9 | 10 | #include %lsp-const.red 11 | #include %system-words.red 12 | #include %lexer.red 13 | #include %semantic.red 14 | 15 | logger: none 16 | open-logger?: false 17 | debug-on?: false 18 | 19 | client-caps: none 20 | shutdown?: no 21 | 22 | versions: [] 23 | workspace-folder: [] 24 | excluded-folder: "" 25 | 26 | init-logger: func [_logger [file! none!]][ 27 | logger: _logger 28 | if logger [ 29 | if exists? _logger [ 30 | txt: read _logger 31 | write %logger.bak txt 32 | ] 33 | delete logger ;-- in case, the file not deleted 34 | write logger "^/" 35 | ] 36 | ] 37 | 38 | write-newline: does [ 39 | #either config/OS = 'Windows [ 40 | write-stdout "^/" 41 | ][ 42 | write-stdout "^M^/" 43 | ] 44 | ] 45 | 46 | write-response: function [resp][ 47 | write-stdout "Content-Length: " 48 | write-stdout to string! length? nresp: to binary! resp 49 | write-newline 50 | write-stdout {Content-Type: application/vscode-jsonrpc; charset=utf-8} 51 | write-newline write-newline 52 | write-stdout nresp 53 | ] 54 | 55 | write-log: function [str [string!]][ 56 | if logger [ 57 | unless empty? str [write/append logger str] 58 | write/append logger "^/" 59 | ] 60 | ] 61 | 62 | json-body: none 63 | 64 | process: function [data [string!]][ 65 | script: load-json data 66 | set 'json-body copy #() 67 | json-body/jsonrpc: "2.0" 68 | if script/id [ 69 | json-body/id: script/id 70 | ] 71 | if script/method [ 72 | dispatch-method script/method script/params 73 | ] 74 | true 75 | ] 76 | 77 | response: function [][ 78 | resp: to-json json-body 79 | write-response resp 80 | write-log rejoin ["[NOW] " mold now/precise] 81 | write-log rejoin ["[OUTPUT] Content-Length: " length? resp] 82 | write-log resp write-log "" 83 | ] 84 | 85 | lsp-read: function [][ 86 | len: 0 87 | until [ 88 | header: trim input-stdin 89 | if find header "Content-Length: " [ 90 | len: to integer! trim/all find/tail header "Content-Length: " 91 | write-log rejoin ["[INPUT] Content-Length: " len] 92 | ] 93 | empty? header 94 | ] 95 | n: 0 96 | bin: make binary! len 97 | until [ 98 | read-stdin skip bin n len - n 99 | n: length? bin 100 | n = len 101 | ] 102 | 103 | also str: to string! bin do [write-log str write-log ""] 104 | ] 105 | 106 | dispatch-method: function [method [string!] params][ 107 | switch method [ 108 | "initialize" [on-initialize params] 109 | "initialized" [on-initialized params] 110 | "workspace/didChangeConfiguration" [on-didChangeConfiguration params] 111 | "workspace/didChangeWorkspaceFolders" [on-didChangeWorkspaceFolders params] 112 | "workspace/didChangeWatchedFiles" [on-didChangeWatchedFiles params] 113 | "shutdown" [on-shutdown params] 114 | "textDocument/didOpen" [on-textDocument-didOpen params] 115 | "textDocument/didClose" [on-textDocument-didClose params] 116 | "textDocument/didChange" [on-textDocument-didChange params] 117 | "textDocument/didSave" [on-textDocument-didSave params] 118 | "textDocument/completion" [on-textDocument-completion params] 119 | "completionItem/resolve" [on-completionItem-resolve params] 120 | "textDocument/documentSymbol" [on-textDocument-symbol params] 121 | "textDocument/hover" [on-textDocument-hover params] 122 | "textDocument/definition" [on-textDocument-definition params] 123 | ] 124 | ] 125 | 126 | TextDocumentSyncKind: [ 127 | None 0 128 | Full 1 129 | Incremental 2 130 | ] 131 | 132 | 133 | trigger-string: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/%.+-_=?*&~?`" 134 | trigger-chars: [] 135 | forall trigger-string [ 136 | append trigger-chars to string! trigger-string/1 137 | ] 138 | on-initialize: function [params [map!]][ 139 | set 'client-caps params 140 | if params/initializationOptions [ 141 | set 'excluded-folder params/initializationOptions/excludedPath 142 | ] 143 | if ws: params/workspaceFolders [ 144 | forall ws [ 145 | append workspace-folder ws/1/uri 146 | ] 147 | ] 148 | caps: copy #() 149 | put caps 'textDocumentSync TextDocumentSyncKind/Incremental 150 | put caps 'hoverProvider true 151 | put caps 'completionProvider 152 | make map! reduce [ 153 | 'resolveProvider true 154 | 'triggerCharacters trigger-chars 155 | ] 156 | put caps 'definitionProvider true 157 | put caps 'documentSymbolProvider true 158 | ;-- slow for now 159 | ;put caps 'workspace make map! reduce [ 160 | ; 'workspaceFolders make map! reduce [ 161 | ; 'supported true 162 | ; 'changeNotifications true 163 | ; ] 164 | ;] 165 | 166 | json-body/result: make map! reduce [ 167 | 'capabilities caps 168 | ] 169 | 170 | ;json-body/result: make map! reduce [ 171 | ; 'capabilities make map! reduce [ 172 | ; 'textDocumentSync TextDocumentSyncKind/Full 173 | ; ;'textDocumentSync make map! reduce [ 174 | ; ; 'openClose true 175 | ; ; 'change 0 176 | ; ; 'willSave false 177 | ; ; 'willSaveWaitUntil false 178 | ; ; 'save make map! reduce ['includeText true] 179 | ; ;] 180 | 181 | ; ;'documentFormattingProvider true 182 | ; ;'documentRangeFormattingProvider true 183 | ; ;'documentOnTypeFormattingProvider make map! reduce ['firstTriggerCharacter "{" 'moreTriggerCharacter ""] 184 | ; ;'codeActionProvider true 185 | ; 'completionProvider make map! reduce ['resolveProvider true 'triggerCharacters trigger-chars] 186 | ; ;'signatureHelpProvider make map! reduce ['triggerCharacters ["."]] 187 | ; ;'definitionProvider true 188 | ; ;'documentHighlightProvider true 189 | ; 'hoverProvider true 190 | ; ;'renameProvider true 191 | ; ;'documentSymbolProvider true 192 | ; ;'workspaceSymbolProvider true 193 | ; ;'referencesProvider true 194 | ; ;'executeCommandProvider make map! reduce ['commands "Red.applyFix"] 195 | ; ] 196 | ;] 197 | 198 | response 199 | ] 200 | 201 | register-watched-files: function [][ 202 | json-body/id: "didChangeWatchedFiles" 203 | json-body/result: none 204 | json-body/method: "client/registerCapability" 205 | json-body/params: make map! reduce [ 206 | 'registrations reduce [ 207 | make map! reduce [ 208 | 'id "didChangeWatchedFiles" 209 | 'method "workspace/didChangeWatchedFiles" 210 | 'registerOptions make map! reduce [ 211 | 'watchers reduce [ 212 | make map! reduce [ 213 | 'globPattern "**/*.{red,reds}" 214 | 'kind 7 215 | ] 216 | ] 217 | ] 218 | ] 219 | ] 220 | ] 221 | response 222 | ] 223 | 224 | on-initialized: function [params [map! none!]][ 225 | exit ;-- slow for now 226 | diags: semantic/add-folder workspace-folder excluded-folder 227 | if empty? diags [ 228 | exit 229 | ] 230 | forall diags [ 231 | json-body/method: "textDocument/publishDiagnostics" 232 | json-body/params: diags/1 233 | response 234 | ] 235 | ] 236 | 237 | on-didChangeConfiguration: function [params [map! none!]][ 238 | if open-logger? <> params/settings/red/rls-debug [ 239 | open-logger?: params/settings/red/rls-debug 240 | unless debug-on? [ 241 | either open-logger? [ 242 | init-logger %logger.txt 243 | ][ 244 | init-logger none 245 | ] 246 | ] 247 | ] 248 | ;-- slow for now 249 | ;register-watched-files 250 | ] 251 | 252 | on-didChangeWorkspaceFolders: function [params [map! none!]][ 253 | added: params/event/added 254 | removed: params/event/removed 255 | unless empty? added [ 256 | added-folder: make block! 4 257 | forall added [ 258 | append added-folder added/1/uri 259 | ] 260 | diags: semantic/add-folder added-folder excluded-folder 261 | if empty? diags [ 262 | exit 263 | ] 264 | forall diags [ 265 | json-body/method: "textDocument/publishDiagnostics" 266 | json-body/params: diags/1 267 | response 268 | ] 269 | ] 270 | unless empty? removed [ 271 | removed-folder: make block! 4 272 | forall removed [ 273 | append removed-folder removed/1/uri 274 | ] 275 | diags: semantic/remove-folder removed-folder 276 | if empty? diags [ 277 | exit 278 | ] 279 | forall diags [ 280 | json-body/method: "textDocument/publishDiagnostics" 281 | json-body/params: diags/1 282 | response 283 | ] 284 | ] 285 | ] 286 | 287 | on-didChangeWatchedFiles: function [params [map! none!]][ 288 | changes: params/changes 289 | forall changes [ 290 | uri: changes/1/uri 291 | either changes/1/type = 3 [ 292 | if vs: find-uri uri [ 293 | remove vs 294 | ] 295 | if item: semantic/find-source uri [ 296 | write-log rejoin ["[INFO]: remove " uri] 297 | remove item 298 | ] 299 | clear-diag uri 300 | ][ 301 | if exists? file: lexer/uri-to-file uri [ 302 | source: read file 303 | diags: semantic/add-source uri source 304 | resp-diags diags uri 305 | ] 306 | ] 307 | ] 308 | ] 309 | 310 | on-shutdown: function [params [map! none!]][ 311 | set 'shutdown? yes 312 | ] 313 | 314 | clear-diag: function [uri [string!]][ 315 | json-body/method: "textDocument/publishDiagnostics" 316 | json-body/params: make map! reduce [ 317 | 'uri uri 318 | 'diagnostics [] 319 | ] 320 | response 321 | ] 322 | 323 | resp-diags: function [diags [block!] uri [string!]][ 324 | if empty? diags [ 325 | clear-diag uri 326 | exit 327 | ] 328 | forall diags [ 329 | json-body/method: "textDocument/publishDiagnostics" 330 | json-body/params: diags/1 331 | response 332 | ] 333 | ] 334 | 335 | find-uri: function [uri [string!]][ 336 | vs: versions 337 | forall vs [ 338 | if vs/1/uri = uri [ 339 | return vs 340 | ] 341 | ] 342 | none 343 | ] 344 | 345 | on-textDocument-didOpen: function [params [map!]][ 346 | source: params/textDocument/text 347 | uri: params/textDocument/uri 348 | version: params/textDocument/version 349 | either vs: find-uri uri [ 350 | vs/1/version: version 351 | ][ 352 | repend/only versions ['uri uri 'version version] 353 | ] 354 | 355 | diags: semantic/add-source uri source 356 | resp-diags diags uri 357 | ] 358 | 359 | on-textDocument-didClose: function [params [map!]][ 360 | uri: params/textDocument/uri 361 | if vs: find-uri uri [ 362 | remove vs 363 | ] 364 | if all [ 365 | not semantic/workspace-file? uri 366 | item: semantic/find-source uri 367 | ][ 368 | write-log rejoin ["[INFO]: remove " uri] 369 | remove item 370 | ] 371 | clear-diag uri 372 | ] 373 | 374 | on-textDocument-didChange: function [params [map!]][ 375 | uri: params/textDocument/uri 376 | unless params/contentChanges/1/range [ 377 | source: params/contentChanges/1/text 378 | diags: semantic/add-source uri source 379 | resp-diags diags uri 380 | exit 381 | ] 382 | version: params/textDocument/version 383 | contentChanges: params/contentChanges 384 | if all [ 385 | vs: find-uri uri 386 | (vs/1/version + 1) = version 387 | ][ 388 | unless diags: semantic/update-source uri contentChanges [ 389 | json-body/error: make map! reduce [ 390 | 'code -32002 391 | 'message "create ast error, please reopen this file!" 392 | ] 393 | write-log "** unknown lexer bug **" 394 | response 395 | exit 396 | ] 397 | resp-diags diags uri 398 | vs/1/version: version 399 | exit 400 | ] 401 | write-log "** lost some text **" 402 | response 403 | ] 404 | 405 | on-textDocument-didSave: function [params [map!]][ 406 | uri: params/textDocument/uri 407 | unless exists? file: lexer/uri-to-file uri [ 408 | write-log "** can't find file: **" 409 | write-log mold file 410 | exit 411 | ] 412 | source: read file 413 | if top: semantic/find-top uri [ 414 | ;source: top/1/source 415 | either not empty? diags: semantic/add-source uri source [ 416 | forall diags [ 417 | json-body/method: "textDocument/publishDiagnostics" 418 | json-body/params: diags/1 419 | response 420 | ] 421 | ][ 422 | clear-diag uri 423 | ] 424 | ] 425 | ] 426 | 427 | on-textDocument-completion: function [params [map!]][ 428 | uri: params/textDocument/uri 429 | line: params/position/line 430 | column: params/position/character 431 | comps: completion/complete uri line + 1 column + 1 432 | json-body/result: make map! reduce [ 433 | ;'isIncomplete true 434 | 'items comps 435 | ] 436 | response 437 | ] 438 | 439 | on-completionItem-resolve: function [params [map!]][ 440 | hstr: completion/resolve params 441 | put params 'documentation either hstr [hstr][""] 442 | json-body/result: params 443 | response 444 | ] 445 | 446 | on-textDocument-hover: function [params [map!]][ 447 | uri: params/textDocument/uri 448 | line: params/position/line 449 | column: params/position/character 450 | result: completion/hover uri line + 1 column + 1 451 | json-body/result: make map! reduce [ 452 | 'contents either result [rejoin ["```^/" result "^/```"]][""] 453 | 'range none 454 | ] 455 | response 456 | ] 457 | 458 | on-textDocument-definition: function [params [map!]][ 459 | uri: params/textDocument/uri 460 | line: params/position/line 461 | column: params/position/character 462 | unless result: completion/definition uri line + 1 column + 1 [result: []] 463 | json-body/result: result 464 | response 465 | ] 466 | 467 | on-textDocument-symbol: function [params [map!]][ 468 | uri: params/textDocument/uri 469 | unless result: completion/symbols uri [result: []] 470 | json-body/result: result 471 | response 472 | ] 473 | 474 | init-logger %logger.txt 475 | semantic/write-log: :write-log 476 | write-log mold system/options/args 477 | 478 | red-version-error: [ 479 | json-body/id: 0 480 | json-body/result: none 481 | json-body/method: none 482 | json-body/params: none 483 | json-body/error: make map! reduce [ 484 | 'code -32002 485 | 'message "Can't work with this 'Red' version^/Please make sure that your Red toolchain newer than red-09jan19-acf34929.exe!" 486 | ] 487 | response 488 | exit 489 | ] 490 | unless value? 'input-stdin [ 491 | write-log "console not support `input-stdin`" 492 | do red-version-error 493 | exit 494 | ] 495 | unless value? 'read-stdin [ 496 | write-log "console not support `read-stdin`" 497 | do red-version-error 498 | exit 499 | ] 500 | 501 | either all [ 502 | system/options/args 503 | system/options/args/1 <> "debug-on" 504 | ][ 505 | init-logger none 506 | open-logger?: false 507 | debug-on?: false 508 | ][ 509 | open-logger?: true 510 | debug-on?: true 511 | ] 512 | 513 | watch: has [res] [ 514 | while [not shutdown?][ 515 | if error? res: try [process lsp-read][ 516 | write-log mold res 517 | ] 518 | ] 519 | write-log "[shutdown]" 520 | ] 521 | 522 | watch 523 | -------------------------------------------------------------------------------- /tests/ast-lines.txt: -------------------------------------------------------------------------------- 1 | 31-Aug-2020/18:58:03+08:00 2 | begin {"} 3 | ================================================ 4 | 5 | [ 6 | [ 7 | range: [1x1 1x2] 8 | nested: 9 | [ 10 | [ 11 | range: [1x1 1x2] 12 | type: string! 13 | upper: [1x1 1x2] 14 | error: [code only-opened at 0] 15 | ] 16 | ] 17 | source: {"} 18 | lines: [ 19 | {"} 20 | 1 21 | ] 22 | ] 23 | ]================================================ 24 | end {"} 25 | 26 | begin {#"^^(00)"} 27 | ================================================ 28 | 29 | [ 30 | [ 31 | range: [1x1 1x9] 32 | nested: 33 | [ 34 | [ 35 | expr: #"^@" 36 | range: [1x1 1x9] 37 | type: char! 38 | upper: [1x1 1x9] 39 | ] 40 | ] 41 | source: {#"^^(00)"} 42 | lines: [ 43 | {#"^^(00)"} 44 | 1 45 | ] 46 | ] 47 | ]================================================ 48 | end {#"^^(00)"} 49 | 50 | begin {#"^^(00)} 51 | ================================================ 52 | 53 | [ 54 | [ 55 | range: [1x1 1x8] 56 | nested: 57 | [ 58 | [ 59 | range: [1x1 1x8] 60 | type: char! 61 | upper: [1x1 1x8] 62 | error: [code not-closed] 63 | ] 64 | ] 65 | source: {#"^^(00)} 66 | lines: [ 67 | {#"^^(00)} 68 | 1 69 | ] 70 | ] 71 | ]================================================ 72 | end {#"^^(00)} 73 | 74 | begin {#"^^(00) a"} 75 | ================================================ 76 | 77 | [ 78 | [ 79 | range: [1x1 1x11] 80 | nested: 81 | [ 82 | [ 83 | range: [1x1 1x11] 84 | type: char! 85 | upper: [1x1 1x11] 86 | error: [code invalid] 87 | ] 88 | ] 89 | source: {#"^^(00) a 90 | lines: [ 91 | {#"^^(00) a 92 | 1 93 | ] 94 | ] 95 | ]================================================ 96 | end {#"^^(00) a"} 97 | 98 | begin {"abc"} 99 | ================================================ 100 | 101 | [ 102 | [ 103 | range: [1x1 1x6] 104 | nested: 105 | [ 106 | [ 107 | expr: "abc" 108 | range: [1x1 1x6] 109 | type: string! 110 | upper: [1x1 1x6] 111 | ] 112 | ] 113 | source: {"abc"} 114 | lines: [ 115 | {"abc"} 116 | 1 117 | ] 118 | ] 119 | ]================================================ 120 | end {"abc"} 121 | 122 | begin {"abc} 123 | ================================================ 124 | 125 | [ 126 | [ 127 | range: [1x1 1x5] 128 | nested: 129 | [ 130 | [ 131 | range: [1x1 1x5] 132 | type: string! 133 | upper: [1x1 1x5] 134 | error: [code only-opened at 0] 135 | ] 136 | ] 137 | source: {"abc} 138 | lines: [ 139 | {"abc} 140 | 1 141 | ] 142 | ] 143 | ]================================================ 144 | end {"abc} 145 | 146 | begin {"abc^/"} 147 | ================================================ 148 | 149 | [ 150 | [ 151 | range: [1x1 2x2] 152 | nested: 153 | [ 154 | [ 155 | range: [1x1 1x5] 156 | type: string! 157 | upper: [1x1 2x2] 158 | error: [code only-opened at 0] 159 | ] 160 | [ 161 | range: [2x1 2x2] 162 | type: string! 163 | upper: [1x1 2x2] 164 | error: [code only-opened at 0] 165 | ] 166 | ] 167 | source: {"abc^/"} 168 | lines: [ 169 | {"abc^/"} 170 | 1 171 | 6 172 | ] 173 | ] 174 | ]================================================ 175 | end {"abc^/"} 176 | 177 | begin "[]" 178 | ================================================ 179 | 180 | [ 181 | [ 182 | range: [1x1 1x3] 183 | nested: 184 | [ 185 | [ 186 | range: [1x1 1x3] 187 | type: block! 188 | upper: [1x1 1x3] 189 | ] 190 | ] 191 | source: "[]" 192 | lines: [ 193 | "[]" 194 | 1 195 | ] 196 | ] 197 | ]================================================ 198 | end "[]" 199 | 200 | begin "[" 201 | ================================================ 202 | 203 | [ 204 | [ 205 | range: [1x1 1x2] 206 | nested: 207 | [ 208 | [ 209 | range: [1x1 1x2] 210 | type: block! 211 | upper: [1x1 1x2] 212 | error: [code only-opened] 213 | ] 214 | ] 215 | source: "[" 216 | lines: [ 217 | "[" 218 | 1 219 | ] 220 | ] 221 | ]================================================ 222 | end "[" 223 | 224 | begin "]" 225 | ================================================ 226 | 227 | [ 228 | [ 229 | range: [1x1 1x2] 230 | nested: 231 | [ 232 | [ 233 | range: [1x1 1x2] 234 | type: block! 235 | upper: [1x1 1x2] 236 | error: [code only-closed] 237 | ] 238 | ] 239 | source: "]" 240 | lines: [ 241 | "]" 242 | 1 243 | ] 244 | ] 245 | ]================================================ 246 | end "]" 247 | 248 | begin "[][" 249 | ================================================ 250 | 251 | [ 252 | [ 253 | range: [1x1 1x4] 254 | nested: 255 | [ 256 | [ 257 | range: [1x1 1x3] 258 | type: block! 259 | upper: [1x1 1x4] 260 | ] 261 | [ 262 | range: [1x3 1x4] 263 | type: block! 264 | upper: [1x1 1x4] 265 | error: [code only-opened] 266 | ] 267 | ] 268 | source: "[][" 269 | lines: [ 270 | "[][" 271 | 1 272 | ] 273 | ] 274 | ]================================================ 275 | end "[][" 276 | 277 | begin "[]]" 278 | ================================================ 279 | 280 | [ 281 | [ 282 | range: [1x1 1x4] 283 | nested: 284 | [ 285 | [ 286 | range: [1x1 1x3] 287 | type: block! 288 | upper: [1x1 1x4] 289 | ] 290 | [ 291 | range: [1x3 1x4] 292 | type: block! 293 | upper: [1x1 1x4] 294 | error: [code only-closed] 295 | ] 296 | ] 297 | source: "[]]" 298 | lines: [ 299 | "[]]" 300 | 1 301 | ] 302 | ] 303 | ]================================================ 304 | end "[]]" 305 | 306 | begin "[[]" 307 | ================================================ 308 | 309 | [ 310 | [ 311 | range: [1x1 1x4] 312 | nested: 313 | [ 314 | [ 315 | range: [1x1 1x4] 316 | type: block! 317 | nested: 318 | [ 319 | [ 320 | range: [1x2 1x4] 321 | type: block! 322 | upper: [1x1 1x4] 323 | ] 324 | ] 325 | upper: [1x1 1x4] 326 | error: [code only-opened] 327 | ] 328 | ] 329 | source: "[[]" 330 | lines: [ 331 | "[[]" 332 | 1 333 | ] 334 | ] 335 | ]================================================ 336 | end "[[]" 337 | 338 | begin "][]" 339 | ================================================ 340 | 341 | [ 342 | [ 343 | range: [1x1 1x4] 344 | nested: 345 | [ 346 | [ 347 | range: [1x1 1x2] 348 | type: block! 349 | upper: [1x1 1x4] 350 | error: [code only-closed] 351 | ] 352 | [ 353 | range: [1x2 1x4] 354 | type: block! 355 | upper: [1x1 1x4] 356 | ] 357 | ] 358 | source: "][]" 359 | lines: [ 360 | "][]" 361 | 1 362 | ] 363 | ] 364 | ]================================================ 365 | end "][]" 366 | 367 | begin "[[]]" 368 | ================================================ 369 | 370 | [ 371 | [ 372 | range: [1x1 1x5] 373 | nested: 374 | [ 375 | [ 376 | range: [1x1 1x5] 377 | type: block! 378 | nested: 379 | [ 380 | [ 381 | range: [1x2 1x4] 382 | type: block! 383 | upper: [1x1 1x5] 384 | ] 385 | ] 386 | upper: [1x1 1x5] 387 | ] 388 | ] 389 | source: "[[]]" 390 | lines: [ 391 | "[[]]" 392 | 1 393 | ] 394 | ] 395 | ]================================================ 396 | end "[[]]" 397 | 398 | begin "()" 399 | ================================================ 400 | 401 | [ 402 | [ 403 | range: [1x1 1x3] 404 | nested: 405 | [ 406 | [ 407 | range: [1x1 1x3] 408 | type: paren! 409 | upper: [1x1 1x3] 410 | ] 411 | ] 412 | source: "()" 413 | lines: [ 414 | "()" 415 | 1 416 | ] 417 | ] 418 | ]================================================ 419 | end "()" 420 | 421 | begin "(" 422 | ================================================ 423 | 424 | [ 425 | [ 426 | range: [1x1 1x2] 427 | nested: 428 | [ 429 | [ 430 | range: [1x1 1x2] 431 | type: paren! 432 | upper: [1x1 1x2] 433 | error: [code only-opened] 434 | ] 435 | ] 436 | source: "(" 437 | lines: [ 438 | "(" 439 | 1 440 | ] 441 | ] 442 | ]================================================ 443 | end "(" 444 | 445 | begin ")" 446 | ================================================ 447 | 448 | [ 449 | [ 450 | range: [1x1 1x2] 451 | nested: 452 | [ 453 | [ 454 | range: [1x1 1x2] 455 | type: paren! 456 | upper: [1x1 1x2] 457 | error: [code only-closed] 458 | ] 459 | ] 460 | source: ")" 461 | lines: [ 462 | ")" 463 | 1 464 | ] 465 | ] 466 | ]================================================ 467 | end ")" 468 | 469 | begin "()(" 470 | ================================================ 471 | 472 | [ 473 | [ 474 | range: [1x1 1x4] 475 | nested: 476 | [ 477 | [ 478 | range: [1x1 1x3] 479 | type: paren! 480 | upper: [1x1 1x4] 481 | ] 482 | [ 483 | range: [1x3 1x4] 484 | type: paren! 485 | upper: [1x1 1x4] 486 | error: [code only-opened] 487 | ] 488 | ] 489 | source: "()(" 490 | lines: [ 491 | "()(" 492 | 1 493 | ] 494 | ] 495 | ]================================================ 496 | end "()(" 497 | 498 | begin "())" 499 | ================================================ 500 | 501 | [ 502 | [ 503 | range: [1x1 1x4] 504 | nested: 505 | [ 506 | [ 507 | range: [1x1 1x3] 508 | type: paren! 509 | upper: [1x1 1x4] 510 | ] 511 | [ 512 | range: [1x3 1x4] 513 | type: paren! 514 | upper: [1x1 1x4] 515 | error: [code only-closed] 516 | ] 517 | ] 518 | source: "())" 519 | lines: [ 520 | "())" 521 | 1 522 | ] 523 | ] 524 | ]================================================ 525 | end "())" 526 | 527 | begin "(()" 528 | ================================================ 529 | 530 | [ 531 | [ 532 | range: [1x1 1x4] 533 | nested: 534 | [ 535 | [ 536 | range: [1x1 1x4] 537 | type: paren! 538 | nested: 539 | [ 540 | [ 541 | range: [1x2 1x4] 542 | type: paren! 543 | upper: [1x1 1x4] 544 | ] 545 | ] 546 | upper: [1x1 1x4] 547 | error: [code only-opened] 548 | ] 549 | ] 550 | source: "(()" 551 | lines: [ 552 | "(()" 553 | 1 554 | ] 555 | ] 556 | ]================================================ 557 | end "(()" 558 | 559 | begin ")()" 560 | ================================================ 561 | 562 | [ 563 | [ 564 | range: [1x1 1x4] 565 | nested: 566 | [ 567 | [ 568 | range: [1x1 1x2] 569 | type: paren! 570 | upper: [1x1 1x4] 571 | error: [code only-closed] 572 | ] 573 | [ 574 | range: [1x2 1x4] 575 | type: paren! 576 | upper: [1x1 1x4] 577 | ] 578 | ] 579 | source: ")()" 580 | lines: [ 581 | ")()" 582 | 1 583 | ] 584 | ] 585 | ]================================================ 586 | end ")()" 587 | 588 | begin "(())" 589 | ================================================ 590 | 591 | [ 592 | [ 593 | range: [1x1 1x5] 594 | nested: 595 | [ 596 | [ 597 | range: [1x1 1x5] 598 | type: paren! 599 | nested: 600 | [ 601 | [ 602 | range: [1x2 1x4] 603 | type: paren! 604 | upper: [1x1 1x5] 605 | ] 606 | ] 607 | upper: [1x1 1x5] 608 | ] 609 | ] 610 | source: "(())" 611 | lines: [ 612 | "(())" 613 | 1 614 | ] 615 | ] 616 | ]================================================ 617 | end "(())" 618 | 619 | begin "{}" 620 | ================================================ 621 | 622 | [ 623 | [ 624 | range: [1x1 1x3] 625 | nested: 626 | [ 627 | [ 628 | expr: "" 629 | range: [1x1 1x3] 630 | type: string! 631 | upper: [1x1 1x3] 632 | ] 633 | ] 634 | source: "{}" 635 | lines: [ 636 | "{}" 637 | 1 638 | ] 639 | ] 640 | ]================================================ 641 | end "{}" 642 | 643 | begin "{" 644 | ================================================ 645 | 646 | [ 647 | [ 648 | range: [1x1 1x2] 649 | nested: 650 | [ 651 | [ 652 | range: [1x1 1x2] 653 | type: string! 654 | upper: [1x1 1x2] 655 | error: [code only-opened at 0] 656 | ] 657 | ] 658 | source: "{" 659 | lines: [ 660 | "{" 661 | 1 662 | ] 663 | ] 664 | ]================================================ 665 | end "{" 666 | 667 | begin "}" 668 | ================================================ 669 | 670 | [ 671 | [ 672 | range: [1x1 1x2] 673 | nested: 674 | [ 675 | [ 676 | range: [1x1 1x2] 677 | type: string! 678 | upper: [1x1 1x2] 679 | error: [code only-closed] 680 | ] 681 | ] 682 | source: "}" 683 | lines: [ 684 | "}" 685 | 1 686 | ] 687 | ] 688 | ]================================================ 689 | end "}" 690 | 691 | begin "{}{" 692 | ================================================ 693 | 694 | [ 695 | [ 696 | range: [1x1 1x4] 697 | nested: 698 | [ 699 | [ 700 | expr: "" 701 | range: [1x1 1x3] 702 | type: string! 703 | upper: [1x1 1x4] 704 | ] 705 | [ 706 | range: [1x3 1x4] 707 | type: string! 708 | upper: [1x1 1x4] 709 | error: [code only-opened at 0] 710 | ] 711 | ] 712 | source: "{}{" 713 | lines: [ 714 | "{}{" 715 | 1 716 | ] 717 | ] 718 | ]================================================ 719 | end "{}{" 720 | 721 | begin "{}}" 722 | ================================================ 723 | 724 | [ 725 | [ 726 | range: [1x1 1x4] 727 | nested: 728 | [ 729 | [ 730 | expr: "" 731 | range: [1x1 1x3] 732 | type: string! 733 | upper: [1x1 1x4] 734 | ] 735 | [ 736 | range: [1x3 1x4] 737 | type: string! 738 | upper: [1x1 1x4] 739 | error: [code only-closed] 740 | ] 741 | ] 742 | source: "{}}" 743 | lines: [ 744 | "{}}" 745 | 1 746 | ] 747 | ] 748 | ]================================================ 749 | end "{}}" 750 | 751 | begin "{{}" 752 | ================================================ 753 | 754 | [ 755 | [ 756 | range: [1x1 1x4] 757 | nested: 758 | [ 759 | [ 760 | range: [1x1 1x3] 761 | type: string! 762 | upper: [1x1 1x4] 763 | error: [code only-opened at 2] 764 | ] 765 | ] 766 | source: "{{}" 767 | lines: [ 768 | "{{}" 769 | 1 770 | ] 771 | ] 772 | ]================================================ 773 | end "{{}" 774 | 775 | begin "}{}" 776 | ================================================ 777 | 778 | [ 779 | [ 780 | range: [1x1 1x4] 781 | nested: 782 | [ 783 | [ 784 | range: [1x1 1x2] 785 | type: string! 786 | upper: [1x1 1x4] 787 | error: [code only-closed] 788 | ] 789 | [ 790 | expr: "" 791 | range: [1x2 1x4] 792 | type: string! 793 | upper: [1x1 1x4] 794 | ] 795 | ] 796 | source: "}{}" 797 | lines: [ 798 | "}{}" 799 | 1 800 | ] 801 | ] 802 | ]================================================ 803 | end "}{}" 804 | 805 | begin "{{}}" 806 | ================================================ 807 | 808 | [ 809 | [ 810 | range: [1x1 1x5] 811 | nested: 812 | [ 813 | [ 814 | expr: "{}" 815 | range: [1x1 1x5] 816 | type: string! 817 | upper: [1x1 1x5] 818 | ] 819 | ] 820 | source: "{{}}" 821 | lines: [ 822 | "{{}}" 823 | 1 824 | ] 825 | ] 826 | ]================================================ 827 | end "{{}}" 828 | 829 | begin "{{" 830 | ================================================ 831 | 832 | [ 833 | [ 834 | range: [1x1 1x3] 835 | nested: 836 | [ 837 | [ 838 | range: [1x1 1x3] 839 | type: string! 840 | upper: [1x1 1x3] 841 | error: [code only-opened at 0] 842 | ] 843 | ] 844 | source: "{{" 845 | lines: [ 846 | "{{" 847 | 1 848 | ] 849 | ] 850 | ]================================================ 851 | end "{{" 852 | 853 | begin "{{{" 854 | ================================================ 855 | 856 | [ 857 | [ 858 | range: [1x1 1x4] 859 | nested: 860 | [ 861 | [ 862 | range: [1x1 1x4] 863 | type: string! 864 | upper: [1x1 1x4] 865 | error: [code only-opened at 0] 866 | ] 867 | ] 868 | source: "{{{" 869 | lines: [ 870 | "{{{" 871 | 1 872 | ] 873 | ] 874 | ]================================================ 875 | end "{{{" 876 | 877 | begin "a/" 878 | ================================================ 879 | 880 | [ 881 | [ 882 | range: [1x1 1x3] 883 | nested: 884 | [ 885 | [ 886 | range: [1x1 1x3] 887 | type: path! 888 | nested: 889 | [ 890 | [ 891 | expr: a 892 | range: [1x1 1x2] 893 | type: word! 894 | upper: [1x1 1x3] 895 | ] 896 | ] 897 | upper: [1x1 1x3] 898 | error: [code slash] 899 | ] 900 | ] 901 | source: "a/" 902 | lines: [ 903 | "a/" 904 | 1 905 | ] 906 | ] 907 | ]================================================ 908 | end "a/" 909 | 910 | begin "a/ " 911 | ================================================ 912 | 913 | [ 914 | [ 915 | range: [1x1 1x4] 916 | nested: 917 | [ 918 | [ 919 | range: [1x1 1x3] 920 | type: path! 921 | nested: 922 | [ 923 | [ 924 | expr: a 925 | range: [1x1 1x2] 926 | type: word! 927 | upper: [1x1 1x3] 928 | ] 929 | ] 930 | upper: [1x1 1x4] 931 | error: [code slash] 932 | ] 933 | ] 934 | source: "a/ " 935 | lines: [ 936 | "a/ " 937 | 1 938 | ] 939 | ] 940 | ]================================================ 941 | end "a/ " 942 | 943 | begin "a/b" 944 | ================================================ 945 | 946 | [ 947 | [ 948 | range: [1x1 1x4] 949 | nested: 950 | [ 951 | [ 952 | range: [1x1 1x4] 953 | type: path! 954 | nested: 955 | [ 956 | [ 957 | expr: a 958 | range: [1x1 1x2] 959 | type: word! 960 | upper: [1x1 1x4] 961 | ] 962 | [ 963 | expr: b 964 | range: [1x3 1x4] 965 | type: word! 966 | upper: [1x1 1x4] 967 | ] 968 | ] 969 | upper: [1x1 1x4] 970 | ] 971 | ] 972 | source: "a/b" 973 | lines: [ 974 | "a/b" 975 | 1 976 | ] 977 | ] 978 | ]================================================ 979 | end "a/b" 980 | 981 | begin "a/b/" 982 | ================================================ 983 | 984 | [ 985 | [ 986 | range: [1x1 1x5] 987 | nested: 988 | [ 989 | [ 990 | range: [1x1 1x5] 991 | type: path! 992 | nested: 993 | [ 994 | [ 995 | expr: a 996 | range: [1x1 1x2] 997 | type: word! 998 | upper: [1x1 1x5] 999 | ] 1000 | [ 1001 | expr: b 1002 | range: [1x3 1x4] 1003 | type: word! 1004 | upper: [1x1 1x5] 1005 | ] 1006 | ] 1007 | upper: [1x1 1x5] 1008 | error: [code slash] 1009 | ] 1010 | ] 1011 | source: "a/b/" 1012 | lines: [ 1013 | "a/b/" 1014 | 1 1015 | ] 1016 | ] 1017 | ]================================================ 1018 | end "a/b/" 1019 | 1020 | begin "'a/b/" 1021 | ================================================ 1022 | 1023 | [ 1024 | [ 1025 | range: [1x1 1x6] 1026 | nested: 1027 | [ 1028 | [ 1029 | range: [1x1 1x6] 1030 | type: lit-path! 1031 | nested: 1032 | [ 1033 | [ 1034 | expr: a 1035 | range: [1x2 1x3] 1036 | type: word! 1037 | upper: [1x1 1x6] 1038 | ] 1039 | [ 1040 | expr: b 1041 | range: [1x4 1x5] 1042 | type: word! 1043 | upper: [1x1 1x6] 1044 | ] 1045 | ] 1046 | upper: [1x1 1x6] 1047 | error: [code slash] 1048 | ] 1049 | ] 1050 | source: "'a/b/" 1051 | lines: [ 1052 | "'a/b/" 1053 | 1 1054 | ] 1055 | ] 1056 | ]================================================ 1057 | end "'a/b/" 1058 | 1059 | begin ":a/b/" 1060 | ================================================ 1061 | 1062 | [ 1063 | [ 1064 | range: [1x1 1x6] 1065 | nested: 1066 | [ 1067 | [ 1068 | range: [1x1 1x6] 1069 | type: get-path! 1070 | nested: 1071 | [ 1072 | [ 1073 | expr: a 1074 | range: [1x2 1x3] 1075 | type: word! 1076 | upper: [1x1 1x6] 1077 | ] 1078 | [ 1079 | expr: b 1080 | range: [1x4 1x5] 1081 | type: word! 1082 | upper: [1x1 1x6] 1083 | ] 1084 | ] 1085 | upper: [1x1 1x6] 1086 | error: [code slash] 1087 | ] 1088 | ] 1089 | source: ":a/b/" 1090 | lines: [ 1091 | ":a/b/" 1092 | 1 1093 | ] 1094 | ] 1095 | ]================================================ 1096 | end ":a/b/" 1097 | 1098 | begin "a/b/ " 1099 | ================================================ 1100 | 1101 | [ 1102 | [ 1103 | range: [1x1 1x6] 1104 | nested: 1105 | [ 1106 | [ 1107 | range: [1x1 1x5] 1108 | type: path! 1109 | nested: 1110 | [ 1111 | [ 1112 | expr: a 1113 | range: [1x1 1x2] 1114 | type: word! 1115 | upper: [1x1 1x5] 1116 | ] 1117 | [ 1118 | expr: b 1119 | range: [1x3 1x4] 1120 | type: word! 1121 | upper: [1x1 1x5] 1122 | ] 1123 | ] 1124 | upper: [1x1 1x6] 1125 | error: [code slash] 1126 | ] 1127 | ] 1128 | source: "a/b/ " 1129 | lines: [ 1130 | "a/b/ " 1131 | 1 1132 | ] 1133 | ] 1134 | ]================================================ 1135 | end "a/b/ " 1136 | 1137 | begin "a/b/:" 1138 | ================================================ 1139 | 1140 | [ 1141 | [ 1142 | range: [1x1 1x6] 1143 | nested: 1144 | [ 1145 | [ 1146 | range: [1x1 1x6] 1147 | type: path! 1148 | nested: 1149 | [ 1150 | [ 1151 | expr: a 1152 | range: [1x1 1x2] 1153 | type: word! 1154 | upper: [1x1 1x6] 1155 | ] 1156 | [ 1157 | expr: b 1158 | range: [1x3 1x4] 1159 | type: word! 1160 | upper: [1x1 1x6] 1161 | ] 1162 | ] 1163 | upper: [1x1 1x6] 1164 | error: [code word! expr ":"] 1165 | ] 1166 | ] 1167 | source: "a/b/:" 1168 | lines: [ 1169 | "a/b/:" 1170 | 1 1171 | ] 1172 | ] 1173 | ]================================================ 1174 | end "a/b/:" 1175 | 1176 | begin "a/b/: " 1177 | ================================================ 1178 | 1179 | [ 1180 | [ 1181 | range: [1x1 1x7] 1182 | nested: 1183 | [ 1184 | [ 1185 | range: [1x1 1x6] 1186 | type: path! 1187 | nested: 1188 | [ 1189 | [ 1190 | expr: a 1191 | range: [1x1 1x2] 1192 | type: word! 1193 | upper: [1x1 1x6] 1194 | ] 1195 | [ 1196 | expr: b 1197 | range: [1x3 1x4] 1198 | type: word! 1199 | upper: [1x1 1x6] 1200 | ] 1201 | ] 1202 | upper: [1x1 1x7] 1203 | error: [code word! expr ":"] 1204 | ] 1205 | ] 1206 | source: "a/b/: " 1207 | lines: [ 1208 | "a/b/: " 1209 | 1 1210 | ] 1211 | ] 1212 | ]================================================ 1213 | end "a/b/: " 1214 | 1215 | begin "a/b/'" 1216 | ================================================ 1217 | 1218 | [ 1219 | [ 1220 | range: [1x1 1x6] 1221 | nested: 1222 | [ 1223 | [ 1224 | range: [1x1 1x6] 1225 | type: path! 1226 | nested: 1227 | [ 1228 | [ 1229 | expr: a 1230 | range: [1x1 1x2] 1231 | type: word! 1232 | upper: [1x1 1x6] 1233 | ] 1234 | [ 1235 | expr: b 1236 | range: [1x3 1x4] 1237 | type: word! 1238 | upper: [1x1 1x6] 1239 | ] 1240 | ] 1241 | upper: [1x1 1x6] 1242 | error: [code word! expr "'"] 1243 | ] 1244 | ] 1245 | source: "a/b/'" 1246 | lines: [ 1247 | "a/b/'" 1248 | 1 1249 | ] 1250 | ] 1251 | ]================================================ 1252 | end "a/b/'" 1253 | 1254 | begin "a/b/' " 1255 | ================================================ 1256 | 1257 | [ 1258 | [ 1259 | range: [1x1 1x7] 1260 | nested: 1261 | [ 1262 | [ 1263 | range: [1x1 1x6] 1264 | type: path! 1265 | nested: 1266 | [ 1267 | [ 1268 | expr: a 1269 | range: [1x1 1x2] 1270 | type: word! 1271 | upper: [1x1 1x6] 1272 | ] 1273 | [ 1274 | expr: b 1275 | range: [1x3 1x4] 1276 | type: word! 1277 | upper: [1x1 1x6] 1278 | ] 1279 | ] 1280 | upper: [1x1 1x7] 1281 | error: [code word! expr "'"] 1282 | ] 1283 | ] 1284 | source: "a/b/' " 1285 | lines: [ 1286 | "a/b/' " 1287 | 1 1288 | ] 1289 | ] 1290 | ]================================================ 1291 | end "a/b/' " 1292 | 1293 | begin "a/b/[" 1294 | ================================================ 1295 | 1296 | [ 1297 | [ 1298 | range: [1x1 1x6] 1299 | nested: 1300 | [ 1301 | [ 1302 | range: [1x1 1x5] 1303 | type: path! 1304 | nested: 1305 | [ 1306 | [ 1307 | expr: a 1308 | range: [1x1 1x2] 1309 | type: word! 1310 | upper: [1x1 1x5] 1311 | ] 1312 | [ 1313 | expr: b 1314 | range: [1x3 1x4] 1315 | type: word! 1316 | upper: [1x1 1x5] 1317 | ] 1318 | ] 1319 | upper: [1x1 1x6] 1320 | error: [code slash] 1321 | ] 1322 | [ 1323 | range: [1x5 1x6] 1324 | type: block! 1325 | upper: [1x1 1x6] 1326 | error: [code only-opened] 1327 | ] 1328 | ] 1329 | source: "a/b/[" 1330 | lines: [ 1331 | "a/b/[" 1332 | 1 1333 | ] 1334 | ] 1335 | ]================================================ 1336 | end "a/b/[" 1337 | 1338 | begin {a/"b} 1339 | ================================================ 1340 | 1341 | [ 1342 | [ 1343 | range: [1x1 1x5] 1344 | nested: 1345 | [ 1346 | [ 1347 | range: [1x1 1x5] 1348 | type: path! 1349 | nested: 1350 | [ 1351 | [ 1352 | expr: a 1353 | range: [1x1 1x2] 1354 | type: word! 1355 | upper: [1x1 1x5] 1356 | ] 1357 | ] 1358 | upper: [1x1 1x5] 1359 | error: [code string! expr {"b}] 1360 | ] 1361 | ] 1362 | source: {a/"b} 1363 | lines: [ 1364 | {a/"b} 1365 | 1 1366 | ] 1367 | ] 1368 | ]================================================ 1369 | end {a/"b} 1370 | 1371 | begin {a/"b } 1372 | ================================================ 1373 | 1374 | [ 1375 | [ 1376 | range: [1x1 1x6] 1377 | nested: 1378 | [ 1379 | [ 1380 | range: [1x1 1x6] 1381 | type: path! 1382 | nested: 1383 | [ 1384 | [ 1385 | expr: a 1386 | range: [1x1 1x2] 1387 | type: word! 1388 | upper: [1x1 1x6] 1389 | ] 1390 | ] 1391 | upper: [1x1 1x6] 1392 | error: [code string! expr {"b }] 1393 | ] 1394 | ] 1395 | source: {a/"b } 1396 | lines: [ 1397 | {a/"b } 1398 | 1 1399 | ] 1400 | ] 1401 | ]================================================ 1402 | end {a/"b } 1403 | 1404 | begin {a/"b"c} 1405 | ================================================ 1406 | 1407 | [ 1408 | [ 1409 | range: [1x1 1x7] 1410 | nested: 1411 | [ 1412 | [ 1413 | range: [1x1 1x7] 1414 | type: path! 1415 | nested: 1416 | [ 1417 | [ 1418 | expr: a 1419 | range: [1x1 1x2] 1420 | type: word! 1421 | upper: [1x1 1x7] 1422 | ] 1423 | [ 1424 | expr: "b" 1425 | range: [1x3 1x6] 1426 | type: string! 1427 | upper: [1x1 1x7] 1428 | ] 1429 | ] 1430 | upper: [1x1 1x7] 1431 | error: [code unknown] 1432 | ] 1433 | ] 1434 | source: {a/"b"c} 1435 | lines: [ 1436 | {a/"b"c} 1437 | 1 1438 | ] 1439 | ] 1440 | ]================================================ 1441 | end {a/"b"c} 1442 | 1443 | begin {a/"b"^^/} 1444 | ================================================ 1445 | 1446 | [ 1447 | [ 1448 | range: [1x1 1x8] 1449 | nested: 1450 | [ 1451 | [ 1452 | range: [1x1 1x8] 1453 | type: path! 1454 | nested: 1455 | [ 1456 | [ 1457 | expr: a 1458 | range: [1x1 1x2] 1459 | type: word! 1460 | upper: [1x1 1x8] 1461 | ] 1462 | [ 1463 | expr: "b" 1464 | range: [1x3 1x6] 1465 | type: string! 1466 | upper: [1x1 1x8] 1467 | ] 1468 | ] 1469 | upper: [1x1 1x8] 1470 | error: [code slash] 1471 | ] 1472 | ] 1473 | source: {a/"b"^^/} 1474 | lines: [ 1475 | {a/"b"^^/} 1476 | 1 1477 | ] 1478 | ] 1479 | ]================================================ 1480 | end {a/"b"^^/} 1481 | 1482 | begin "abc;--comment" 1483 | ================================================ 1484 | 1485 | [ 1486 | [ 1487 | range: [1x1 1x14] 1488 | nested: 1489 | [ 1490 | [ 1491 | expr: abc 1492 | range: [1x1 1x4] 1493 | type: word! 1494 | upper: [1x1 1x14] 1495 | ] 1496 | [ 1497 | range: [1x4 1x14] 1498 | type: comment 1499 | upper: [1x1 1x14] 1500 | ] 1501 | ] 1502 | source: "abc;--com 1503 | lines: [ 1504 | "abc;--com 1505 | 1 1506 | ] 1507 | ] 1508 | ]================================================ 1509 | end "abc;--comment" 1510 | 1511 | begin "abc;--comment^/" 1512 | ================================================ 1513 | 1514 | [ 1515 | [ 1516 | range: [1x1 2x1] 1517 | nested: 1518 | [ 1519 | [ 1520 | expr: abc 1521 | range: [1x1 1x4] 1522 | type: word! 1523 | upper: [1x1 2x1] 1524 | ] 1525 | [ 1526 | range: [1x4 1x14] 1527 | type: comment 1528 | upper: [1x1 2x1] 1529 | ] 1530 | ] 1531 | source: "abc;--com 1532 | lines: [ 1533 | "abc;--com 1534 | 1 1535 | 15 1536 | ] 1537 | ] 1538 | ]================================================ 1539 | end "abc;--comment^/" 1540 | 1541 | begin "abc;--comment^/efg" 1542 | ================================================ 1543 | 1544 | [ 1545 | [ 1546 | range: [1x1 2x4] 1547 | nested: 1548 | [ 1549 | [ 1550 | expr: abc 1551 | range: [1x1 1x4] 1552 | type: word! 1553 | upper: [1x1 2x4] 1554 | ] 1555 | [ 1556 | range: [1x4 1x14] 1557 | type: comment 1558 | upper: [1x1 2x4] 1559 | ] 1560 | [ 1561 | expr: efg 1562 | range: [2x1 2x4] 1563 | type: word! 1564 | upper: [1x1 2x4] 1565 | ] 1566 | ] 1567 | source: "abc;--com 1568 | lines: [ 1569 | "abc;--com 1570 | 1 1571 | 15 1572 | ] 1573 | ] 1574 | ]================================================ 1575 | end "abc;--comment^/efg" 1576 | 1577 | begin ";--comment^/abc" 1578 | ================================================ 1579 | 1580 | [ 1581 | [ 1582 | range: [1x1 2x4] 1583 | nested: 1584 | [ 1585 | [ 1586 | range: [1x1 1x11] 1587 | type: comment 1588 | upper: [1x1 2x4] 1589 | ] 1590 | [ 1591 | expr: abc 1592 | range: [2x1 2x4] 1593 | type: word! 1594 | upper: [1x1 2x4] 1595 | ] 1596 | ] 1597 | source: ";--commen 1598 | lines: [ 1599 | ";--commen 1600 | 1 1601 | 12 1602 | ] 1603 | ] 1604 | ]================================================ 1605 | end ";--comment^/abc" 1606 | 1607 | begin "[;--comment^/]" 1608 | ================================================ 1609 | 1610 | [ 1611 | [ 1612 | range: [1x1 2x2] 1613 | nested: 1614 | [ 1615 | [ 1616 | range: [1x1 2x2] 1617 | type: block! 1618 | nested: 1619 | [ 1620 | [ 1621 | range: [1x2 1x12] 1622 | type: comment 1623 | upper: [1x1 2x2] 1624 | ] 1625 | ] 1626 | upper: [1x1 2x2] 1627 | ] 1628 | ] 1629 | source: "[;--comme 1630 | lines: [ 1631 | "[;--comme 1632 | 1 1633 | 13 1634 | ] 1635 | ] 1636 | ]================================================ 1637 | end "[;--comment^/]" 1638 | 1639 | begin "(;--comment^/)" 1640 | ================================================ 1641 | 1642 | [ 1643 | [ 1644 | range: [1x1 2x2] 1645 | nested: 1646 | [ 1647 | [ 1648 | range: [1x1 2x2] 1649 | type: paren! 1650 | nested: 1651 | [ 1652 | [ 1653 | range: [1x2 1x12] 1654 | type: comment 1655 | upper: [1x1 2x2] 1656 | ] 1657 | ] 1658 | upper: [1x1 2x2] 1659 | ] 1660 | ] 1661 | source: "(;--comme 1662 | lines: [ 1663 | "(;--comme 1664 | 1 1665 | 13 1666 | ] 1667 | ] 1668 | ]================================================ 1669 | end "(;--comment^/)" 1670 | 1671 | begin "a/b;--comment^/" 1672 | ================================================ 1673 | 1674 | [ 1675 | [ 1676 | range: [1x1 2x1] 1677 | nested: 1678 | [ 1679 | [ 1680 | range: [1x1 1x4] 1681 | type: path! 1682 | nested: 1683 | [ 1684 | [ 1685 | expr: a 1686 | range: [1x1 1x2] 1687 | type: word! 1688 | upper: [1x1 1x4] 1689 | ] 1690 | [ 1691 | expr: b 1692 | range: [1x3 1x4] 1693 | type: word! 1694 | upper: [1x1 1x4] 1695 | ] 1696 | ] 1697 | upper: [1x1 2x1] 1698 | ] 1699 | [ 1700 | range: [1x4 1x14] 1701 | type: comment 1702 | upper: [1x1 2x1] 1703 | ] 1704 | ] 1705 | source: "a/b;--com 1706 | lines: [ 1707 | "a/b;--com 1708 | 1 1709 | 15 1710 | ] 1711 | ] 1712 | ]================================================ 1713 | end "a/b;--comment^/" 1714 | 1715 | begin "a/;--comment^/" 1716 | ================================================ 1717 | 1718 | [ 1719 | [ 1720 | range: [1x1 2x1] 1721 | nested: 1722 | [ 1723 | [ 1724 | range: [1x1 1x3] 1725 | type: path! 1726 | nested: 1727 | [ 1728 | [ 1729 | expr: a 1730 | range: [1x1 1x2] 1731 | type: word! 1732 | upper: [1x1 1x3] 1733 | ] 1734 | ] 1735 | upper: [1x1 2x1] 1736 | error: [code slash] 1737 | ] 1738 | [ 1739 | range: [1x3 1x13] 1740 | type: comment 1741 | upper: [1x1 2x1] 1742 | ] 1743 | ] 1744 | source: "a/;--comm 1745 | lines: [ 1746 | "a/;--comm 1747 | 1 1748 | 14 1749 | ] 1750 | ] 1751 | ]================================================ 1752 | end "a/;--comment^/" 1753 | 1754 | -------------------------------------------------------------------------------- /tests/ast-cases.txt: -------------------------------------------------------------------------------- 1 | 31-Aug-2020/18:55:23+08:00 2 | begin %binary.txt 3 | ================================================ 4 | 5 | [ 6 | [ 7 | range: [1x1 15x1] 8 | nested: 9 | [ 10 | [ 11 | expr: #{12345678} 12 | range: [1x1 1x13] 13 | type: binary! 14 | upper: [1x1 15x1] 15 | ] 16 | [ 17 | expr: #{12345678} 18 | range: [2x1 3x6] 19 | type: binary! 20 | upper: [1x1 15x1] 21 | ] 22 | [ 23 | range: [4x8 4x13] 24 | type: binary! 25 | upper: [1x1 15x1] 26 | error: [code invalid] 27 | ] 28 | [ 29 | expr: #{01020304} 30 | range: [5x1 5x16] 31 | type: binary! 32 | upper: [1x1 15x1] 33 | ] 34 | [ 35 | range: [6x6 6x7] 36 | type: binary! 37 | upper: [1x1 15x1] 38 | error: [code invalid] 39 | ] 40 | [ 41 | expr: #{55} 42 | range: [7x1 7x13] 43 | type: binary! 44 | upper: [1x1 15x1] 45 | ] 46 | [ 47 | range: [8x7 8x9] 48 | type: binary! 49 | upper: [1x1 15x1] 50 | error: [code invalid] 51 | ] 52 | [ 53 | expr: #{CDEF} 54 | range: [9x1 9x10] 55 | type: binary! 56 | upper: [1x1 15x1] 57 | ] 58 | [ 59 | range: [10x7 10x10] 60 | type: binary! 61 | upper: [1x1 15x1] 62 | error: [code invalid] 63 | ] 64 | [ 65 | expr: #{61} 66 | range: [11x1 11x10] 67 | type: binary! 68 | upper: [1x1 15x1] 69 | ] 70 | [ 71 | range: [12x7 12x8] 72 | type: binary! 73 | upper: [1x1 15x1] 74 | error: [code invalid] 75 | ] 76 | [ 77 | expr: #{01FF} 78 | range: [13x1 13x8] 79 | type: binary! 80 | upper: [1x1 15x1] 81 | ] 82 | [ 83 | range: [13x8 13x9] 84 | type: string! 85 | upper: [1x1 15x1] 86 | error: [code only-closed] 87 | ] 88 | [ 89 | range: [14x1 15x1] 90 | type: binary! 91 | upper: [1x1 15x1] 92 | error: [code not-closed] 93 | ] 94 | ] 95 | source: {#^{1234 56 96 | lines: [ 97 | {#^{1234 56 98 | 1 99 | 14 100 | 21 101 | 27 102 | 40 103 | 56 104 | 63 105 | 76 106 | 85 107 | 95 108 | 105 109 | 115 110 | 123 111 | 132 112 | 139 113 | ] 114 | ] 115 | ] 116 | ================================================ 117 | end %binary.txt 118 | 119 | begin %block.txt 120 | ================================================ 121 | 122 | [ 123 | [ 124 | range: [1x1 16x1] 125 | nested: 126 | [ 127 | [ 128 | range: [1x1 3x2] 129 | type: block! 130 | nested: 131 | [ 132 | [ 133 | expr: this 134 | range: [2x2 2x6] 135 | type: word! 136 | upper: [1x1 3x2] 137 | ] 138 | [ 139 | expr: is 140 | range: [2x7 2x9] 141 | type: word! 142 | upper: [1x1 3x2] 143 | ] 144 | [ 145 | expr: a 146 | range: [2x10 2x11] 147 | type: word! 148 | upper: [1x1 3x2] 149 | ] 150 | [ 151 | expr: block! 152 | range: [2x12 2x18] 153 | type: word! 154 | upper: [1x1 3x2] 155 | ] 156 | ] 157 | upper: [1x1 16x1] 158 | ] 159 | [ 160 | range: [5x1 5x6] 161 | type: block! 162 | nested: 163 | [ 164 | [ 165 | range: [5x2 5x6] 166 | type: paren! 167 | nested: 168 | [ 169 | [ 170 | range: [5x3 5x6] 171 | type: map! 172 | upper: [5x2 5x6] 173 | error: [code only-opened] 174 | ] 175 | ] 176 | upper: [5x1 5x6] 177 | error: [code only-opened] 178 | ] 179 | ] 180 | upper: [1x1 16x1] 181 | ] 182 | [ 183 | range: [6x1 6x3] 184 | type: block! 185 | upper: [1x1 16x1] 186 | error: [code only-opened] 187 | ] 188 | [ 189 | range: [6x2 6x3] 190 | type: string! 191 | upper: [1x1 16x1] 192 | error: [code only-closed] 193 | ] 194 | [ 195 | range: [6x3 6x4] 196 | type: block! 197 | upper: [1x1 16x1] 198 | error: [code only-closed] 199 | ] 200 | [ 201 | range: [8x1 8x21] 202 | type: block! 203 | nested: 204 | [ 205 | [ 206 | expr: match 207 | range: [8x2 8x7] 208 | type: word! 209 | upper: [8x1 8x21] 210 | ] 211 | [ 212 | range: [8x8 8x13] 213 | type: block! 214 | nested: 215 | [ 216 | [ 217 | range: [8x9 8x12] 218 | type: block! 219 | nested: 220 | [ 221 | [ 222 | expr: a 223 | range: [8x10 8x11] 224 | type: word! 225 | upper: [8x9 8x12] 226 | ] 227 | ] 228 | upper: [8x8 8x13] 229 | ] 230 | ] 231 | upper: [8x1 8x21] 232 | ] 233 | [ 234 | expr: block! 235 | range: [8x14 8x20] 236 | type: word! 237 | upper: [8x1 8x21] 238 | ] 239 | ] 240 | upper: [1x1 16x1] 241 | ] 242 | [ 243 | range: [9x1 11x2] 244 | type: block! 245 | nested: 246 | [ 247 | [ 248 | expr: match 249 | range: [10x2 10x7] 250 | type: word! 251 | upper: [9x1 11x2] 252 | ] 253 | [ 254 | expr: 1 255 | range: [10x8 10x9] 256 | type: integer! 257 | upper: [9x1 11x2] 258 | ] 259 | ] 260 | upper: [1x1 16x1] 261 | ] 262 | [ 263 | range: [11x2 11x3] 264 | type: block! 265 | upper: [1x1 16x1] 266 | error: [code only-closed] 267 | ] 268 | [ 269 | range: [13x1 16x1] 270 | type: block! 271 | nested: 272 | [ 273 | [ 274 | range: [13x2 15x2] 275 | type: block! 276 | nested: 277 | [ 278 | [ 279 | expr: match 280 | range: [14x2 14x7] 281 | type: word! 282 | upper: [13x2 15x2] 283 | ] 284 | [ 285 | expr: 2 286 | range: [14x8 14x9] 287 | type: integer! 288 | upper: [13x2 15x2] 289 | ] 290 | ] 291 | upper: [13x1 16x1] 292 | ] 293 | ] 294 | upper: [1x1 16x1] 295 | error: [code only-opened] 296 | ] 297 | ] 298 | source: {[^/^-this i 299 | lines: [ 300 | {[^/^-this i 301 | 1 302 | 3 303 | 21 304 | 23 305 | 24 306 | 30 307 | 34 308 | 35 309 | 56 310 | 58 311 | 67 312 | 70 313 | 71 314 | 74 315 | 83 316 | 85 317 | ] 318 | ] 319 | ] 320 | ================================================ 321 | end %block.txt 322 | 323 | begin %char.txt 324 | ================================================ 325 | 326 | [ 327 | [ 328 | range: [1x1 17x1] 329 | nested: 330 | [ 331 | [ 332 | expr: #"^@" 333 | range: [1x1 1x4] 334 | type: char! 335 | upper: [1x1 17x1] 336 | ] 337 | [ 338 | expr: #"0" 339 | range: [2x1 2x9] 340 | type: char! 341 | upper: [1x1 17x1] 342 | ] 343 | [ 344 | expr: #"ㄲ" 345 | range: [3x1 3x11] 346 | type: char! 347 | upper: [1x1 17x1] 348 | ] 349 | [ 350 | range: [4x1 4x13] 351 | type: char! 352 | upper: [1x1 17x1] 353 | error: [code invalid] 354 | ] 355 | [ 356 | range: [5x1 5x15] 357 | type: char! 358 | upper: [1x1 17x1] 359 | error: [code invalid] 360 | ] 361 | [ 362 | range: [6x1 6x17] 363 | type: char! 364 | upper: [1x1 17x1] 365 | error: [code invalid] 366 | ] 367 | [ 368 | range: [7x1 7x19] 369 | type: char! 370 | upper: [1x1 17x1] 371 | error: [code invalid] 372 | ] 373 | [ 374 | range: [8x1 8x21] 375 | type: char! 376 | upper: [1x1 17x1] 377 | error: [code invalid] 378 | ] 379 | [ 380 | expr: #"^/" 381 | range: [9x1 9x11] 382 | type: char! 383 | upper: [1x1 17x1] 384 | ] 385 | [ 386 | range: [10x1 10x14] 387 | type: char! 388 | upper: [1x1 17x1] 389 | error: [code invalid] 390 | ] 391 | [ 392 | range: [11x1 11x7] 393 | type: char! 394 | upper: [1x1 17x1] 395 | error: [code invalid] 396 | ] 397 | [ 398 | range: [12x1 12x12] 399 | type: char! 400 | upper: [1x1 17x1] 401 | error: [code invalid] 402 | ] 403 | [ 404 | range: [13x1 14x3] 405 | type: char! 406 | upper: [1x1 17x1] 407 | error: [code invalid] 408 | ] 409 | [ 410 | range: [15x1 17x1] 411 | type: char! 412 | upper: [1x1 17x1] 413 | error: [code not-closed] 414 | ] 415 | ] 416 | source: {#""^/#"^^(3 417 | lines: [ 418 | {#""^/#"^^(3 419 | 1 420 | 5 421 | 14 422 | 25 423 | 38 424 | 53 425 | 70 426 | 89 427 | 110 428 | 121 429 | 135 430 | 142 431 | 154 432 | 163 433 | 166 434 | 170 435 | 181 436 | ] 437 | ] 438 | ] 439 | ================================================ 440 | end %char.txt 441 | 442 | begin %map.txt 443 | ================================================ 444 | 445 | [ 446 | [ 447 | range: [1x1 22x6] 448 | nested: 449 | [ 450 | [ 451 | range: [2x1 2x18] 452 | type: map! 453 | nested: 454 | [ 455 | [ 456 | expr: this 457 | range: [2x3 2x7] 458 | type: word! 459 | upper: [2x1 2x18] 460 | ] 461 | [ 462 | expr: is 463 | range: [2x8 2x10] 464 | type: word! 465 | upper: [2x1 2x18] 466 | ] 467 | [ 468 | expr: a 469 | range: [2x11 2x12] 470 | type: word! 471 | upper: [2x1 2x18] 472 | ] 473 | [ 474 | expr: map! 475 | range: [2x13 2x17] 476 | type: word! 477 | upper: [2x1 2x18] 478 | ] 479 | ] 480 | upper: [1x1 22x6] 481 | ] 482 | [ 483 | range: [3x1 3x8] 484 | type: map! 485 | nested: 486 | [ 487 | [ 488 | range: [3x3 3x7] 489 | type: paren! 490 | nested: 491 | [ 492 | [ 493 | range: [3x4 3x6] 494 | type: block! 495 | upper: [3x3 3x7] 496 | ] 497 | ] 498 | upper: [3x1 3x8] 499 | ] 500 | ] 501 | upper: [1x1 22x6] 502 | ] 503 | [ 504 | range: [4x1 4x8] 505 | type: block! 506 | nested: 507 | [ 508 | [ 509 | range: [4x2 4x7] 510 | type: paren! 511 | nested: 512 | [ 513 | [ 514 | range: [4x3 4x6] 515 | type: map! 516 | upper: [4x2 4x7] 517 | ] 518 | ] 519 | upper: [4x1 4x8] 520 | ] 521 | ] 522 | upper: [1x1 22x6] 523 | ] 524 | [ 525 | range: [5x1 5x10] 526 | type: map! 527 | nested: 528 | [ 529 | [ 530 | range: [5x3 5x9] 531 | type: map! 532 | nested: 533 | [ 534 | [ 535 | range: [5x5 5x8] 536 | type: map! 537 | upper: [5x3 5x9] 538 | ] 539 | ] 540 | upper: [5x1 5x10] 541 | ] 542 | ] 543 | upper: [1x1 22x6] 544 | ] 545 | [ 546 | range: [7x1 15x2] 547 | type: map! 548 | nested: 549 | [ 550 | [ 551 | expr: a: 552 | range: [8x2 8x4] 553 | type: set-word! 554 | upper: [7x1 15x2] 555 | ] 556 | [ 557 | range: [8x5 14x3] 558 | type: map! 559 | nested: 560 | [ 561 | [ 562 | expr: b: 563 | range: [9x3 9x5] 564 | type: set-word! 565 | upper: [8x5 14x3] 566 | ] 567 | [ 568 | range: [9x6 13x4] 569 | type: paren! 570 | nested: 571 | [ 572 | [ 573 | expr: c: 574 | range: [10x4 10x6] 575 | type: set-word! 576 | upper: [9x6 13x4] 577 | ] 578 | [ 579 | range: [10x7 12x5] 580 | type: block! 581 | nested: 582 | [ 583 | [ 584 | expr: d: 585 | range: [11x5 11x7] 586 | type: set-word! 587 | upper: [10x7 12x5] 588 | ] 589 | [ 590 | expr: "string!" 591 | range: [11x8 11x17] 592 | type: string! 593 | upper: [10x7 12x5] 594 | ] 595 | ] 596 | upper: [9x6 13x4] 597 | ] 598 | ] 599 | upper: [8x5 14x3] 600 | ] 601 | ] 602 | upper: [7x1 15x2] 603 | ] 604 | ] 605 | upper: [1x1 22x6] 606 | ] 607 | [ 608 | range: [17x1 17x6] 609 | type: block! 610 | nested: 611 | [ 612 | [ 613 | range: [17x2 17x5] 614 | type: map! 615 | upper: [17x1 17x6] 616 | ] 617 | ] 618 | upper: [1x1 22x6] 619 | error: [code only-opened] 620 | ] 621 | [ 622 | range: [17x5 17x6] 623 | type: paren! 624 | upper: [1x1 22x6] 625 | error: [code only-closed] 626 | ] 627 | [ 628 | range: [17x6 17x7] 629 | type: block! 630 | upper: [1x1 22x6] 631 | error: [code only-closed] 632 | ] 633 | [ 634 | range: [18x1 18x8] 635 | type: block! 636 | nested: 637 | [ 638 | [ 639 | range: [18x2 18x8] 640 | type: map! 641 | nested: 642 | [ 643 | [ 644 | range: [18x4 18x7] 645 | type: map! 646 | upper: [18x2 18x8] 647 | ] 648 | ] 649 | upper: [18x1 18x8] 650 | error: [code only-opened] 651 | ] 652 | ] 653 | upper: [1x1 22x6] 654 | ] 655 | [ 656 | range: [19x1 19x5] 657 | type: map! 658 | nested: 659 | [ 660 | [ 661 | range: [19x3 19x5] 662 | type: block! 663 | upper: [19x1 19x5] 664 | error: [code only-opened] 665 | ] 666 | ] 667 | upper: [1x1 22x6] 668 | ] 669 | [ 670 | range: [20x1 20x4] 671 | type: map! 672 | upper: [1x1 22x6] 673 | error: [code only-opened] 674 | ] 675 | [ 676 | range: [20x3 20x4] 677 | type: block! 678 | upper: [1x1 22x6] 679 | error: [code only-closed] 680 | ] 681 | [ 682 | range: [20x4 20x5] 683 | type: paren! 684 | upper: [1x1 22x6] 685 | error: [code only-closed] 686 | ] 687 | [ 688 | range: [21x1 22x6] 689 | type: map! 690 | nested: 691 | [ 692 | [ 693 | expr: map! 694 | range: [22x2 22x6] 695 | type: word! 696 | upper: [21x1 22x6] 697 | ] 698 | ] 699 | upper: [1x1 22x6] 700 | error: [code only-opened] 701 | ] 702 | ] 703 | source: {^/#(this i 704 | lines: [ 705 | {^/#(this i 706 | 1 707 | 2 708 | 20 709 | 28 710 | 36 711 | 46 712 | 47 713 | 50 714 | 57 715 | 64 716 | 72 717 | 89 718 | 94 719 | 98 720 | 101 721 | 103 722 | 104 723 | 111 724 | 119 725 | 124 726 | 129 727 | 132 728 | ] 729 | ] 730 | ] 731 | ================================================ 732 | end %map.txt 733 | 734 | begin %mixure.red 735 | ================================================ 736 | 737 | [ 738 | [ 739 | range: [1x1 78x1] 740 | nested: 741 | [ 742 | [ 743 | expr: Red 744 | range: [1x1 1x4] 745 | type: word! 746 | upper: [1x1 78x1] 747 | ] 748 | [ 749 | expr: he: 750 | range: [1x5 1x8] 751 | type: set-word! 752 | upper: [1x1 78x1] 753 | ] 754 | [ 755 | range: [1x9 1x11] 756 | type: block! 757 | upper: [1x1 78x1] 758 | ] 759 | [ 760 | expr: a: 761 | range: [3x1 3x3] 762 | type: set-word! 763 | upper: [1x1 78x1] 764 | ] 765 | [ 766 | expr: 'test 767 | range: [3x4 3x9] 768 | type: lit-word! 769 | upper: [1x1 78x1] 770 | ] 771 | [ 772 | expr: b: 773 | range: [4x1 4x3] 774 | type: set-word! 775 | upper: [1x1 78x1] 776 | ] 777 | [ 778 | expr: context 779 | range: [4x4 4x11] 780 | type: word! 781 | upper: [1x1 78x1] 782 | ] 783 | [ 784 | range: [4x12 33x2] 785 | type: block! 786 | nested: 787 | [ 788 | [ 789 | expr: a: 790 | range: [5x2 5x4] 791 | type: set-word! 792 | upper: [4x12 33x2] 793 | ] 794 | [ 795 | expr: a 796 | range: [5x5 5x6] 797 | type: word! 798 | upper: [4x12 33x2] 799 | ] 800 | [ 801 | expr: c: 802 | range: [6x2 6x4] 803 | type: set-word! 804 | upper: [4x12 33x2] 805 | ] 806 | [ 807 | expr: 4 808 | range: [6x5 6x6] 809 | type: integer! 810 | upper: [4x12 33x2] 811 | ] 812 | [ 813 | expr: d: 814 | range: [7x2 7x4] 815 | type: set-word! 816 | upper: [4x12 33x2] 817 | ] 818 | [ 819 | expr: context 820 | range: [7x5 7x12] 821 | type: word! 822 | upper: [4x12 33x2] 823 | ] 824 | [ 825 | range: [7x13 28x3] 826 | type: block! 827 | nested: 828 | [ 829 | [ 830 | expr: e: 831 | range: [8x3 8x5] 832 | type: set-word! 833 | upper: [7x13 28x3] 834 | ] 835 | [ 836 | expr: #{12} 837 | range: [8x6 8x11] 838 | type: binary! 839 | upper: [7x13 28x3] 840 | ] 841 | [ 842 | expr: f: 843 | range: [9x3 9x5] 844 | type: set-word! 845 | upper: [7x13 28x3] 846 | ] 847 | [ 848 | expr: func 849 | range: [9x6 9x10] 850 | type: word! 851 | upper: [7x13 28x3] 852 | ] 853 | [ 854 | range: [9x11 9x36] 855 | type: block! 856 | nested: 857 | [ 858 | [ 859 | expr: x 860 | range: [9x12 9x13] 861 | type: word! 862 | upper: [9x11 9x36] 863 | ] 864 | [ 865 | range: [9x14 9x22] 866 | type: block! 867 | nested: 868 | [ 869 | [ 870 | expr: block! 871 | range: [9x15 9x21] 872 | type: word! 873 | upper: [9x14 9x22] 874 | ] 875 | ] 876 | upper: [9x11 9x36] 877 | ] 878 | [ 879 | expr: y 880 | range: [9x23 9x24] 881 | type: word! 882 | upper: [9x11 9x36] 883 | ] 884 | [ 885 | range: [9x25 9x35] 886 | type: block! 887 | nested: 888 | [ 889 | [ 890 | expr: integer! 891 | range: [9x26 9x34] 892 | type: word! 893 | upper: [9x25 9x35] 894 | ] 895 | ] 896 | upper: [9x11 9x36] 897 | ] 898 | ] 899 | upper: [7x13 28x3] 900 | ] 901 | [ 902 | range: [9x36 26x4] 903 | type: block! 904 | nested: 905 | [ 906 | [ 907 | expr: ff: 908 | range: [10x4 10x7] 909 | type: set-word! 910 | upper: [9x36 26x4] 911 | ] 912 | [ 913 | expr: function 914 | range: [10x8 10x16] 915 | type: word! 916 | upper: [9x36 26x4] 917 | ] 918 | [ 919 | range: [10x17 10x43] 920 | type: block! 921 | nested: 922 | [ 923 | [ 924 | expr: a 925 | range: [10x18 10x19] 926 | type: word! 927 | upper: [10x17 10x43] 928 | ] 929 | [ 930 | range: [10x20 10x30] 931 | type: block! 932 | nested: 933 | [ 934 | [ 935 | expr: integer! 936 | range: [10x21 10x29] 937 | type: word! 938 | upper: [10x20 10x30] 939 | ] 940 | ] 941 | upper: [10x17 10x43] 942 | ] 943 | [ 944 | expr: b 945 | range: [10x31 10x32] 946 | type: word! 947 | upper: [10x17 10x43] 948 | ] 949 | [ 950 | range: [10x33 10x42] 951 | type: block! 952 | nested: 953 | [ 954 | [ 955 | expr: binary! 956 | range: [10x34 10x41] 957 | type: word! 958 | upper: [10x33 10x42] 959 | ] 960 | ] 961 | upper: [10x17 10x43] 962 | ] 963 | ] 964 | upper: [9x36 26x4] 965 | ] 966 | [ 967 | range: [10x43 19x5] 968 | type: block! 969 | nested: 970 | [ 971 | [ 972 | expr: f1: 973 | range: [11x5 11x8] 974 | type: set-word! 975 | upper: [10x43 19x5] 976 | ] 977 | [ 978 | expr: "test" 979 | range: [11x9 11x15] 980 | type: string! 981 | upper: [10x43 19x5] 982 | ] 983 | [ 984 | expr: f2: 985 | range: [12x5 12x8] 986 | type: set-word! 987 | upper: [10x43 19x5] 988 | ] 989 | [ 990 | expr: x 991 | range: [12x9 12x10] 992 | type: word! 993 | upper: [10x43 19x5] 994 | ] 995 | [ 996 | expr: f3: 997 | range: [13x5 13x8] 998 | type: set-word! 999 | upper: [10x43 19x5] 1000 | ] 1001 | [ 1002 | expr: f1 1003 | range: [13x9 13x11] 1004 | type: word! 1005 | upper: [10x43 19x5] 1006 | ] 1007 | [ 1008 | expr: f4: 1009 | range: [14x5 14x8] 1010 | type: set-word! 1011 | upper: [10x43 19x5] 1012 | ] 1013 | [ 1014 | expr: l 1015 | range: [14x9 14x10] 1016 | type: word! 1017 | upper: [10x43 19x5] 1018 | ] 1019 | [ 1020 | expr: f5: 1021 | range: [15x5 15x8] 1022 | type: set-word! 1023 | upper: [10x43 19x5] 1024 | ] 1025 | [ 1026 | expr: :f 1027 | range: [15x9 15x11] 1028 | type: get-word! 1029 | upper: [10x43 19x5] 1030 | ] 1031 | [ 1032 | expr: f6: 1033 | range: [16x5 16x8] 1034 | type: set-word! 1035 | upper: [10x43 19x5] 1036 | ] 1037 | [ 1038 | expr: f5 1039 | range: [16x9 16x11] 1040 | type: word! 1041 | upper: [10x43 19x5] 1042 | ] 1043 | [ 1044 | expr: f7: 1045 | range: [17x5 17x8] 1046 | type: set-word! 1047 | upper: [10x43 19x5] 1048 | ] 1049 | [ 1050 | expr: a 1051 | range: [17x9 17x10] 1052 | type: word! 1053 | upper: [10x43 19x5] 1054 | ] 1055 | [ 1056 | expr: + 1057 | range: [17x11 17x12] 1058 | type: word! 1059 | upper: [10x43 19x5] 1060 | ] 1061 | [ 1062 | expr: length? 1063 | range: [17x13 17x20] 1064 | type: word! 1065 | upper: [10x43 19x5] 1066 | ] 1067 | [ 1068 | expr: b 1069 | range: [17x21 17x22] 1070 | type: word! 1071 | upper: [10x43 19x5] 1072 | ] 1073 | [ 1074 | expr: f 1075 | range: [18x5 18x6] 1076 | type: word! 1077 | upper: [10x43 19x5] 1078 | ] 1079 | ] 1080 | upper: [9x36 26x4] 1081 | ] 1082 | [ 1083 | expr: x: 1084 | range: [20x4 20x6] 1085 | type: set-word! 1086 | upper: [9x36 26x4] 1087 | ] 1088 | [ 1089 | expr: 1 1090 | range: [20x7 20x8] 1091 | type: integer! 1092 | upper: [9x36 26x4] 1093 | ] 1094 | [ 1095 | expr: y: 1096 | range: [21x4 21x6] 1097 | type: set-word! 1098 | upper: [9x36 26x4] 1099 | ] 1100 | [ 1101 | expr: 1 1102 | range: [21x7 21x8] 1103 | type: integer! 1104 | upper: [9x36 26x4] 1105 | ] 1106 | [ 1107 | expr: e: 1108 | range: [22x4 22x6] 1109 | type: set-word! 1110 | upper: [9x36 26x4] 1111 | ] 1112 | [ 1113 | expr: x 1114 | range: [22x7 22x8] 1115 | type: word! 1116 | upper: [9x36 26x4] 1117 | ] 1118 | [ 1119 | expr: + 1120 | range: [22x9 22x10] 1121 | type: word! 1122 | upper: [9x36 26x4] 1123 | ] 1124 | [ 1125 | expr: y 1126 | range: [22x11 22x12] 1127 | type: word! 1128 | upper: [9x36 26x4] 1129 | ] 1130 | [ 1131 | expr: o: 1132 | range: [23x4 23x6] 1133 | type: set-word! 1134 | upper: [9x36 26x4] 1135 | ] 1136 | [ 1137 | expr: g 1138 | range: [23x7 23x8] 1139 | type: word! 1140 | upper: [9x36 26x4] 1141 | ] 1142 | [ 1143 | expr: t: 1144 | range: [24x4 24x6] 1145 | type: set-word! 1146 | upper: [9x36 26x4] 1147 | ] 1148 | [ 1149 | expr: h 1150 | range: [24x7 24x8] 1151 | type: word! 1152 | upper: [9x36 26x4] 1153 | ] 1154 | [ 1155 | expr: u: 1156 | range: [25x4 25x6] 1157 | type: set-word! 1158 | upper: [9x36 26x4] 1159 | ] 1160 | [ 1161 | expr: x 1162 | range: [25x7 25x8] 1163 | type: word! 1164 | upper: [9x36 26x4] 1165 | ] 1166 | ] 1167 | upper: [7x13 28x3] 1168 | ] 1169 | [ 1170 | expr: g: 1171 | range: [27x3 27x5] 1172 | type: set-word! 1173 | upper: [7x13 28x3] 1174 | ] 1175 | [ 1176 | range: [27x6 27x8] 1177 | type: block! 1178 | upper: [7x13 28x3] 1179 | ] 1180 | ] 1181 | upper: [4x12 33x2] 1182 | ] 1183 | [ 1184 | expr: h: 1185 | range: [29x2 29x4] 1186 | type: set-word! 1187 | upper: [4x12 33x2] 1188 | ] 1189 | [ 1190 | range: [29x5 29x12] 1191 | type: map! 1192 | nested: 1193 | [ 1194 | [ 1195 | expr: a: 1196 | range: [29x7 29x9] 1197 | type: set-word! 1198 | upper: [29x5 29x12] 1199 | ] 1200 | [ 1201 | expr: 3 1202 | range: [29x10 29x11] 1203 | type: integer! 1204 | upper: [29x5 29x12] 1205 | ] 1206 | ] 1207 | upper: [4x12 33x2] 1208 | ] 1209 | [ 1210 | expr: i: 1211 | range: [30x2 30x4] 1212 | type: set-word! 1213 | upper: [4x12 33x2] 1214 | ] 1215 | [ 1216 | expr: x 1217 | range: [30x5 30x6] 1218 | type: word! 1219 | upper: [4x12 33x2] 1220 | ] 1221 | [ 1222 | expr: j: 1223 | range: [31x2 31x4] 1224 | type: set-word! 1225 | upper: [4x12 33x2] 1226 | ] 1227 | [ 1228 | expr: e 1229 | range: [31x5 31x6] 1230 | type: word! 1231 | upper: [4x12 33x2] 1232 | ] 1233 | [ 1234 | expr: k: 1235 | range: [32x2 32x4] 1236 | type: set-word! 1237 | upper: [4x12 33x2] 1238 | ] 1239 | [ 1240 | expr: t 1241 | range: [32x5 32x6] 1242 | type: word! 1243 | upper: [4x12 33x2] 1244 | ] 1245 | ] 1246 | upper: [1x1 78x1] 1247 | ] 1248 | [ 1249 | expr: l: 1250 | range: [35x1 35x3] 1251 | type: set-word! 1252 | upper: [1x1 78x1] 1253 | ] 1254 | [ 1255 | range: [35x4 35x15] 1256 | type: paren! 1257 | nested: 1258 | [ 1259 | [ 1260 | expr: m: 1261 | range: [35x5 35x7] 1262 | type: set-word! 1263 | upper: [35x4 35x15] 1264 | ] 1265 | [ 1266 | expr: 3 1267 | range: [35x8 35x9] 1268 | type: integer! 1269 | upper: [35x4 35x15] 1270 | ] 1271 | [ 1272 | expr: n: 1273 | range: [35x10 35x12] 1274 | type: set-word! 1275 | upper: [35x4 35x15] 1276 | ] 1277 | [ 1278 | expr: a 1279 | range: [35x13 35x14] 1280 | type: word! 1281 | upper: [35x4 35x15] 1282 | ] 1283 | ] 1284 | upper: [1x1 78x1] 1285 | ] 1286 | [ 1287 | expr: o: 1288 | range: [36x1 36x3] 1289 | type: set-word! 1290 | upper: [1x1 78x1] 1291 | ] 1292 | [ 1293 | expr: l 1294 | range: [36x4 36x5] 1295 | type: word! 1296 | upper: [1x1 78x1] 1297 | ] 1298 | [ 1299 | expr: r: 1300 | range: [38x1 38x3] 1301 | type: set-word! 1302 | upper: [1x1 78x1] 1303 | ] 1304 | [ 1305 | expr: func 1306 | range: [38x4 38x8] 1307 | type: word! 1308 | upper: [1x1 78x1] 1309 | ] 1310 | [ 1311 | range: [38x9 44x2] 1312 | type: block! 1313 | nested: 1314 | [ 1315 | [ 1316 | expr: a 1317 | range: [39x2 39x3] 1318 | type: word! 1319 | upper: [38x9 44x2] 1320 | ] 1321 | [ 1322 | range: [39x4 39x10] 1323 | type: block! 1324 | nested: 1325 | [ 1326 | [ 1327 | expr: test 1328 | range: [39x5 39x9] 1329 | type: word! 1330 | upper: [39x4 39x10] 1331 | ] 1332 | ] 1333 | upper: [38x9 44x2] 1334 | ] 1335 | [ 1336 | expr: b 1337 | range: [40x2 40x3] 1338 | type: word! 1339 | upper: [38x9 44x2] 1340 | ] 1341 | [ 1342 | range: [40x4 40x11] 1343 | type: block! 1344 | nested: 1345 | [ 1346 | [ 1347 | expr: test! 1348 | range: [40x5 40x10] 1349 | type: word! 1350 | upper: [40x4 40x11] 1351 | ] 1352 | ] 1353 | upper: [38x9 44x2] 1354 | ] 1355 | [ 1356 | expr: /part 1357 | range: [41x2 41x7] 1358 | type: refinement! 1359 | upper: [38x9 44x2] 1360 | ] 1361 | [ 1362 | expr: length 1363 | range: [41x8 41x14] 1364 | type: word! 1365 | upper: [38x9 44x2] 1366 | ] 1367 | [ 1368 | range: [41x15 41x33] 1369 | type: block! 1370 | nested: 1371 | [ 1372 | [ 1373 | expr: integer! 1374 | range: [41x16 41x24] 1375 | type: word! 1376 | upper: [41x15 41x33] 1377 | ] 1378 | [ 1379 | expr: string! 1380 | range: [41x25 41x32] 1381 | type: word! 1382 | upper: [41x15 41x33] 1383 | ] 1384 | ] 1385 | upper: [38x9 44x2] 1386 | ] 1387 | [ 1388 | expr: return: 1389 | range: [42x2 42x9] 1390 | type: set-word! 1391 | upper: [38x9 44x2] 1392 | ] 1393 | [ 1394 | range: [42x10 42x18] 1395 | type: block! 1396 | nested: 1397 | [ 1398 | [ 1399 | expr: block! 1400 | range: [42x11 42x17] 1401 | type: word! 1402 | upper: [42x10 42x18] 1403 | ] 1404 | ] 1405 | upper: [38x9 44x2] 1406 | ] 1407 | [ 1408 | range: [42x19 42x27] 1409 | type: comment 1410 | upper: [38x9 44x2] 1411 | ] 1412 | [ 1413 | expr: /local 1414 | range: [43x2 43x8] 1415 | type: refinement! 1416 | upper: [38x9 44x2] 1417 | ] 1418 | [ 1419 | expr: x 1420 | range: [43x9 43x10] 1421 | type: word! 1422 | upper: [38x9 44x2] 1423 | ] 1424 | [ 1425 | expr: y 1426 | range: [43x11 43x12] 1427 | type: word! 1428 | upper: [38x9 44x2] 1429 | ] 1430 | ] 1431 | upper: [1x1 78x1] 1432 | ] 1433 | [ 1434 | range: [44x2 48x2] 1435 | type: block! 1436 | nested: 1437 | [ 1438 | [ 1439 | expr: if 1440 | range: [45x2 45x4] 1441 | type: word! 1442 | upper: [44x2 48x2] 1443 | ] 1444 | [ 1445 | expr: part 1446 | range: [45x5 45x9] 1447 | type: word! 1448 | upper: [44x2 48x2] 1449 | ] 1450 | [ 1451 | range: [45x10 45x18] 1452 | type: block! 1453 | nested: 1454 | [ 1455 | [ 1456 | expr: length 1457 | range: [45x11 45x17] 1458 | type: word! 1459 | upper: [45x10 45x18] 1460 | ] 1461 | ] 1462 | upper: [44x2 48x2] 1463 | ] 1464 | [ 1465 | expr: x: 1466 | range: [46x2 46x4] 1467 | type: set-word! 1468 | upper: [44x2 48x2] 1469 | ] 1470 | [ 1471 | expr: 1 1472 | range: [46x5 46x6] 1473 | type: integer! 1474 | upper: [44x2 48x2] 1475 | ] 1476 | [ 1477 | expr: y: 1478 | range: [46x7 46x9] 1479 | type: set-word! 1480 | upper: [44x2 48x2] 1481 | ] 1482 | [ 1483 | expr: 1 1484 | range: [46x10 46x11] 1485 | type: integer! 1486 | upper: [44x2 48x2] 1487 | ] 1488 | [ 1489 | expr: a 1490 | range: [47x2 47x3] 1491 | type: word! 1492 | upper: [44x2 48x2] 1493 | ] 1494 | [ 1495 | expr: + 1496 | range: [47x4 47x5] 1497 | type: word! 1498 | upper: [44x2 48x2] 1499 | ] 1500 | [ 1501 | expr: b 1502 | range: [47x6 47x7] 1503 | type: word! 1504 | upper: [44x2 48x2] 1505 | ] 1506 | [ 1507 | expr: + 1508 | range: [47x8 47x9] 1509 | type: word! 1510 | upper: [44x2 48x2] 1511 | ] 1512 | [ 1513 | expr: 1 1514 | range: [47x10 47x11] 1515 | type: integer! 1516 | upper: [44x2 48x2] 1517 | ] 1518 | [ 1519 | expr: + 1520 | range: [47x12 47x13] 1521 | type: word! 1522 | upper: [44x2 48x2] 1523 | ] 1524 | [ 1525 | expr: 1 1526 | range: [47x14 47x15] 1527 | type: integer! 1528 | upper: [44x2 48x2] 1529 | ] 1530 | ] 1531 | upper: [1x1 78x1] 1532 | ] 1533 | [ 1534 | expr: s: 1535 | range: [50x1 50x3] 1536 | type: set-word! 1537 | upper: [1x1 78x1] 1538 | ] 1539 | [ 1540 | expr: function 1541 | range: [50x4 50x12] 1542 | type: word! 1543 | upper: [1x1 78x1] 1544 | ] 1545 | [ 1546 | range: [50x13 50x56] 1547 | type: block! 1548 | nested: 1549 | [ 1550 | [ 1551 | expr: uri 1552 | range: [50x14 50x17] 1553 | type: word! 1554 | upper: [50x13 50x56] 1555 | ] 1556 | [ 1557 | range: [50x18 50x27] 1558 | type: block! 1559 | nested: 1560 | [ 1561 | [ 1562 | expr: string! 1563 | range: [50x19 50x26] 1564 | type: word! 1565 | upper: [50x18 50x27] 1566 | ] 1567 | ] 1568 | upper: [50x13 50x56] 1569 | ] 1570 | [ 1571 | expr: code 1572 | range: [50x28 50x32] 1573 | type: word! 1574 | upper: [50x13 50x56] 1575 | ] 1576 | [ 1577 | range: [50x33 50x42] 1578 | type: block! 1579 | nested: 1580 | [ 1581 | [ 1582 | expr: string! 1583 | range: [50x34 50x41] 1584 | type: word! 1585 | upper: [50x33 50x42] 1586 | ] 1587 | ] 1588 | upper: [50x13 50x56] 1589 | ] 1590 | [ 1591 | expr: blk 1592 | range: [50x43 50x46] 1593 | type: word! 1594 | upper: [50x13 50x56] 1595 | ] 1596 | [ 1597 | range: [50x47 50x55] 1598 | type: block! 1599 | nested: 1600 | [ 1601 | [ 1602 | expr: block! 1603 | range: [50x48 50x54] 1604 | type: word! 1605 | upper: [50x47 50x55] 1606 | ] 1607 | ] 1608 | upper: [50x13 50x56] 1609 | ] 1610 | ] 1611 | upper: [1x1 78x1] 1612 | ] 1613 | [ 1614 | range: [50x56 56x2] 1615 | type: block! 1616 | nested: 1617 | [ 1618 | [ 1619 | expr: either 1620 | range: [51x2 51x8] 1621 | type: word! 1622 | upper: [50x56 56x2] 1623 | ] 1624 | [ 1625 | expr: uri 1626 | range: [51x9 51x12] 1627 | type: word! 1628 | upper: [50x56 56x2] 1629 | ] 1630 | [ 1631 | range: [51x13 53x3] 1632 | type: block! 1633 | nested: 1634 | [ 1635 | [ 1636 | expr: return 1637 | range: [52x3 52x9] 1638 | type: word! 1639 | upper: [51x13 53x3] 1640 | ] 1641 | [ 1642 | expr: reduce 1643 | range: [52x10 52x16] 1644 | type: word! 1645 | upper: [51x13 53x3] 1646 | ] 1647 | [ 1648 | range: [52x17 52x31] 1649 | type: block! 1650 | nested: 1651 | [ 1652 | [ 1653 | expr: uri 1654 | range: [52x18 52x21] 1655 | type: word! 1656 | upper: [52x17 52x31] 1657 | ] 1658 | [ 1659 | expr: code 1660 | range: [52x22 52x26] 1661 | type: word! 1662 | upper: [52x17 52x31] 1663 | ] 1664 | [ 1665 | expr: blk 1666 | range: [52x27 52x30] 1667 | type: word! 1668 | upper: [52x17 52x31] 1669 | ] 1670 | ] 1671 | upper: [51x13 53x3] 1672 | ] 1673 | ] 1674 | upper: [50x56 56x2] 1675 | ] 1676 | [ 1677 | range: [53x3 55x3] 1678 | type: block! 1679 | nested: 1680 | [ 1681 | [ 1682 | expr: return 1683 | range: [54x3 54x9] 1684 | type: word! 1685 | upper: [53x3 55x3] 1686 | ] 1687 | [ 1688 | expr: reduce 1689 | range: [54x10 54x16] 1690 | type: word! 1691 | upper: [53x3 55x3] 1692 | ] 1693 | [ 1694 | range: [54x17 54x31] 1695 | type: block! 1696 | nested: 1697 | [ 1698 | [ 1699 | expr: uri 1700 | range: [54x18 54x21] 1701 | type: word! 1702 | upper: [54x17 54x31] 1703 | ] 1704 | [ 1705 | expr: code 1706 | range: [54x22 54x26] 1707 | type: word! 1708 | upper: [54x17 54x31] 1709 | ] 1710 | [ 1711 | expr: blk 1712 | range: [54x27 54x30] 1713 | type: word! 1714 | upper: [54x17 54x31] 1715 | ] 1716 | ] 1717 | upper: [53x3 55x3] 1718 | ] 1719 | ] 1720 | upper: [50x56 56x2] 1721 | ] 1722 | ] 1723 | upper: [1x1 78x1] 1724 | ] 1725 | [ 1726 | expr: fff: 1727 | range: [58x1 58x5] 1728 | type: set-word! 1729 | upper: [1x1 78x1] 1730 | ] 1731 | [ 1732 | expr: 3 1733 | range: [58x6 58x7] 1734 | type: integer! 1735 | upper: [1x1 78x1] 1736 | ] 1737 | [ 1738 | expr: ft: 1739 | range: [60x1 60x4] 1740 | type: set-word! 1741 | upper: [1x1 78x1] 1742 | ] 1743 | [ 1744 | expr: func 1745 | range: [60x5 60x9] 1746 | type: word! 1747 | upper: [1x1 78x1] 1748 | ] 1749 | [ 1750 | range: [60x10 60x104] 1751 | type: block! 1752 | nested: 1753 | [ 1754 | [ 1755 | expr: a 1756 | range: [60x11 60x12] 1757 | type: word! 1758 | upper: [60x10 60x104] 1759 | ] 1760 | [ 1761 | range: [60x13 60x21] 1762 | type: block! 1763 | nested: 1764 | [ 1765 | [ 1766 | expr: block! 1767 | range: [60x14 60x20] 1768 | type: word! 1769 | upper: [60x13 60x21] 1770 | ] 1771 | ] 1772 | upper: [60x10 60x104] 1773 | ] 1774 | [ 1775 | expr: b 1776 | range: [60x22 60x23] 1777 | type: word! 1778 | upper: [60x10 60x104] 1779 | ] 1780 | [ 1781 | range: [60x24 60x39] 1782 | type: block! 1783 | nested: 1784 | [ 1785 | [ 1786 | expr: map! 1787 | range: [60x25 60x29] 1788 | type: word! 1789 | upper: [60x24 60x39] 1790 | ] 1791 | [ 1792 | expr: integer! 1793 | range: [60x30 60x38] 1794 | type: word! 1795 | upper: [60x24 60x39] 1796 | ] 1797 | ] 1798 | upper: [60x10 60x104] 1799 | ] 1800 | [ 1801 | expr: return: 1802 | range: [60x40 60x47] 1803 | type: set-word! 1804 | upper: [60x10 60x104] 1805 | ] 1806 | [ 1807 | range: [60x48 60x58] 1808 | type: block! 1809 | nested: 1810 | [ 1811 | [ 1812 | expr: integer! 1813 | range: [60x49 60x57] 1814 | type: word! 1815 | upper: [60x48 60x58] 1816 | ] 1817 | ] 1818 | upper: [60x10 60x104] 1819 | ] 1820 | [ 1821 | expr: c 1822 | range: [60x59 60x60] 1823 | type: word! 1824 | upper: [60x10 60x104] 1825 | ] 1826 | [ 1827 | range: [60x61 60x71] 1828 | type: block! 1829 | nested: 1830 | [ 1831 | [ 1832 | expr: integer! 1833 | range: [60x62 60x70] 1834 | type: word! 1835 | upper: [60x61 60x71] 1836 | ] 1837 | ] 1838 | upper: [60x10 60x104] 1839 | ] 1840 | [ 1841 | expr: /c 1842 | range: [60x72 60x74] 1843 | type: refinement! 1844 | upper: [60x10 60x104] 1845 | ] 1846 | [ 1847 | expr: a 1848 | range: [60x75 60x76] 1849 | type: word! 1850 | upper: [60x10 60x104] 1851 | ] 1852 | [ 1853 | range: [60x77 60x87] 1854 | type: block! 1855 | nested: 1856 | [ 1857 | [ 1858 | expr: integer! 1859 | range: [60x78 60x86] 1860 | type: word! 1861 | upper: [60x77 60x87] 1862 | ] 1863 | ] 1864 | upper: [60x10 60x104] 1865 | ] 1866 | [ 1867 | expr: /d 1868 | range: [60x88 60x90] 1869 | type: refinement! 1870 | upper: [60x10 60x104] 1871 | ] 1872 | [ 1873 | expr: /local 1874 | range: [60x91 60x97] 1875 | type: refinement! 1876 | upper: [60x10 60x104] 1877 | ] 1878 | [ 1879 | expr: x 1880 | range: [60x98 60x99] 1881 | type: word! 1882 | upper: [60x10 60x104] 1883 | ] 1884 | [ 1885 | expr: y 1886 | range: [60x100 60x101] 1887 | type: word! 1888 | upper: [60x10 60x104] 1889 | ] 1890 | [ 1891 | expr: z 1892 | range: [60x102 60x103] 1893 | type: word! 1894 | upper: [60x10 60x104] 1895 | ] 1896 | ] 1897 | upper: [1x1 78x1] 1898 | ] 1899 | [ 1900 | range: [60x104 63x2] 1901 | type: block! 1902 | nested: 1903 | [ 1904 | [ 1905 | expr: reduce 1906 | range: [61x2 61x8] 1907 | type: word! 1908 | upper: [60x104 63x2] 1909 | ] 1910 | [ 1911 | range: [61x9 61x18] 1912 | type: block! 1913 | nested: 1914 | [ 1915 | [ 1916 | expr: a 1917 | range: [61x10 61x11] 1918 | type: word! 1919 | upper: [61x9 61x18] 1920 | ] 1921 | [ 1922 | expr: b 1923 | range: [61x12 61x13] 1924 | type: word! 1925 | upper: [61x9 61x18] 1926 | ] 1927 | [ 1928 | expr: c 1929 | range: [61x14 61x15] 1930 | type: word! 1931 | upper: [61x9 61x18] 1932 | ] 1933 | [ 1934 | expr: d 1935 | range: [61x16 61x17] 1936 | type: word! 1937 | upper: [61x9 61x18] 1938 | ] 1939 | ] 1940 | upper: [60x104 63x2] 1941 | ] 1942 | [ 1943 | range: [62x2 62x12] 1944 | type: path! 1945 | nested: 1946 | [ 1947 | [ 1948 | expr: find 1949 | range: [62x2 62x6] 1950 | type: word! 1951 | upper: [62x2 62x12] 1952 | ] 1953 | [ 1954 | expr: match 1955 | range: [62x7 62x12] 1956 | type: word! 1957 | upper: [62x2 62x12] 1958 | ] 1959 | ] 1960 | upper: [60x104 63x2] 1961 | ] 1962 | [ 1963 | expr: "adb" 1964 | range: [62x13 62x18] 1965 | type: string! 1966 | upper: [60x104 63x2] 1967 | ] 1968 | [ 1969 | expr: "a" 1970 | range: [62x19 62x22] 1971 | type: string! 1972 | upper: [60x104 63x2] 1973 | ] 1974 | ] 1975 | upper: [1x1 78x1] 1976 | ] 1977 | [ 1978 | expr: fh1: 1979 | range: [65x1 65x5] 1980 | type: set-word! 1981 | upper: [1x1 78x1] 1982 | ] 1983 | [ 1984 | expr: has 1985 | range: [65x6 65x9] 1986 | type: word! 1987 | upper: [1x1 78x1] 1988 | ] 1989 | [ 1990 | range: [65x10 65x20] 1991 | type: block! 1992 | nested: 1993 | [ 1994 | [ 1995 | expr: /ref 1996 | range: [65x11 65x15] 1997 | type: refinement! 1998 | upper: [65x10 65x20] 1999 | ] 2000 | [ 2001 | expr: a 2002 | range: [65x16 65x17] 2003 | type: word! 2004 | upper: [65x10 65x20] 2005 | ] 2006 | [ 2007 | expr: b 2008 | range: [65x18 65x19] 2009 | type: word! 2010 | upper: [65x10 65x20] 2011 | ] 2012 | ] 2013 | upper: [1x1 78x1] 2014 | ] 2015 | [ 2016 | expr: fh2: 2017 | range: [66x1 66x5] 2018 | type: set-word! 2019 | upper: [1x1 78x1] 2020 | ] 2021 | [ 2022 | expr: has 2023 | range: [66x6 66x9] 2024 | type: word! 2025 | upper: [1x1 78x1] 2026 | ] 2027 | [ 2028 | range: [66x10 66x15] 2029 | type: block! 2030 | nested: 2031 | [ 2032 | [ 2033 | expr: a 2034 | range: [66x11 66x12] 2035 | type: word! 2036 | upper: [66x10 66x15] 2037 | ] 2038 | [ 2039 | expr: b 2040 | range: [66x13 66x14] 2041 | type: word! 2042 | upper: [66x10 66x15] 2043 | ] 2044 | ] 2045 | upper: [1x1 78x1] 2046 | ] 2047 | [ 2048 | range: [66x15 66x17] 2049 | type: block! 2050 | upper: [1x1 78x1] 2051 | ] 2052 | [ 2053 | expr: z: 2054 | range: [68x1 68x3] 2055 | type: set-word! 2056 | upper: [1x1 78x1] 2057 | ] 2058 | [ 2059 | expr: z 2060 | range: [68x4 68x5] 2061 | type: word! 2062 | upper: [1x1 78x1] 2063 | ] 2064 | [ 2065 | expr: blk: 2066 | range: [70x1 70x5] 2067 | type: set-word! 2068 | upper: [1x1 78x1] 2069 | ] 2070 | [ 2071 | range: [70x6 70x12] 2072 | type: block! 2073 | nested: 2074 | [ 2075 | [ 2076 | expr: a: 2077 | range: [70x7 70x9] 2078 | type: set-word! 2079 | upper: [70x6 70x12] 2080 | ] 2081 | [ 2082 | expr: 1 2083 | range: [70x10 70x11] 2084 | type: integer! 2085 | upper: [70x6 70x12] 2086 | ] 2087 | ] 2088 | upper: [1x1 78x1] 2089 | ] 2090 | [ 2091 | expr: ctx: 2092 | range: [71x1 71x5] 2093 | type: set-word! 2094 | upper: [1x1 78x1] 2095 | ] 2096 | [ 2097 | expr: context 2098 | range: [71x6 71x13] 2099 | type: word! 2100 | upper: [1x1 78x1] 2101 | ] 2102 | [ 2103 | range: [71x14 73x2] 2104 | type: block! 2105 | nested: 2106 | [ 2107 | [ 2108 | expr: a: 2109 | range: [72x2 72x4] 2110 | type: set-word! 2111 | upper: [71x14 73x2] 2112 | ] 2113 | [ 2114 | expr: none 2115 | range: [72x5 72x9] 2116 | type: word! 2117 | upper: [71x14 73x2] 2118 | ] 2119 | ] 2120 | upper: [1x1 78x1] 2121 | ] 2122 | [ 2123 | expr: do 2124 | range: [75x1 75x3] 2125 | type: word! 2126 | upper: [1x1 78x1] 2127 | ] 2128 | [ 2129 | expr: bind 2130 | range: [75x4 75x8] 2131 | type: word! 2132 | upper: [1x1 78x1] 2133 | ] 2134 | [ 2135 | expr: blk 2136 | range: [75x9 75x12] 2137 | type: word! 2138 | upper: [1x1 78x1] 2139 | ] 2140 | [ 2141 | expr: ctx 2142 | range: [75x13 75x16] 2143 | type: word! 2144 | upper: [1x1 78x1] 2145 | ] 2146 | [ 2147 | expr: if 2148 | range: [77x1 77x3] 2149 | type: word! 2150 | upper: [1x1 78x1] 2151 | ] 2152 | [ 2153 | expr: all 2154 | range: [77x4 77x7] 2155 | type: word! 2156 | upper: [1x1 78x1] 2157 | ] 2158 | [ 2159 | expr: tt: 2160 | range: [77x8 77x11] 2161 | type: set-word! 2162 | upper: [1x1 78x1] 2163 | ] 2164 | [ 2165 | range: [77x12 77x30] 2166 | type: block! 2167 | nested: 2168 | [ 2169 | [ 2170 | expr: a 2171 | range: [77x13 77x14] 2172 | type: word! 2173 | upper: [77x12 77x30] 2174 | ] 2175 | [ 2176 | expr: = 2177 | range: [77x15 77x16] 2178 | type: word! 2179 | upper: [77x12 77x30] 2180 | ] 2181 | [ 2182 | expr: 1 2183 | range: [77x17 77x18] 2184 | type: integer! 2185 | upper: [77x12 77x30] 2186 | ] 2187 | [ 2188 | expr: integer? 2189 | range: [77x19 77x27] 2190 | type: word! 2191 | upper: [77x12 77x30] 2192 | ] 2193 | [ 2194 | expr: a 2195 | range: [77x28 77x29] 2196 | type: word! 2197 | upper: [77x12 77x30] 2198 | ] 2199 | ] 2200 | upper: [1x1 78x1] 2201 | ] 2202 | [ 2203 | range: [77x30 77x39] 2204 | type: block! 2205 | nested: 2206 | [ 2207 | [ 2208 | expr: print 2209 | range: [77x31 77x36] 2210 | type: word! 2211 | upper: [77x30 77x39] 2212 | ] 2213 | [ 2214 | expr: 3 2215 | range: [77x37 77x38] 2216 | type: integer! 2217 | upper: [77x30 77x39] 2218 | ] 2219 | ] 2220 | upper: [1x1 78x1] 2221 | ] 2222 | ] 2223 | source: {Red he: [ 2224 | lines: [ 2225 | {Red he: [ 2226 | 1 2227 | 12 2228 | 13 2229 | 22 2230 | 35 2231 | 41 2232 | 47 2233 | 61 2234 | 72 2235 | 109 2236 | 153 2237 | 168 2238 | 178 2239 | 189 2240 | 199 2241 | 210 2242 | 221 2243 | 243 2244 | 249 2245 | 254 2246 | 262 2247 | 270 2248 | 282 2249 | 290 2250 | 298 2251 | 306 2252 | 310 2253 | 318 2254 | 321 2255 | 333 2256 | 339 2257 | 345 2258 | 351 2259 | 353 2260 | 354 2261 | 369 2262 | 374 2263 | 375 2264 | 385 2265 | 395 2266 | 406 2267 | 439 2268 | 466 2269 | 478 2270 | 481 2271 | 499 2272 | 510 2273 | 525 2274 | 527 2275 | 528 2276 | 585 2277 | 599 2278 | 630 2279 | 634 2280 | 665 2281 | 668 2282 | 670 2283 | 671 2284 | 678 2285 | 679 2286 | 784 2287 | 802 2288 | 824 2289 | 826 2290 | 827 2291 | 847 2292 | 864 2293 | 865 2294 | 870 2295 | 871 2296 | 883 2297 | 898 2298 | 907 2299 | 909 2300 | 910 2301 | 926 2302 | 927 2303 | 966 2304 | ] 2305 | ] 2306 | ] 2307 | ================================================ 2308 | end %mixure.red 2309 | 2310 | begin %mstring.txt 2311 | ================================================ 2312 | 2313 | [ 2314 | [ 2315 | range: [1x1 11x1] 2316 | nested: 2317 | [ 2318 | [ 2319 | expr: "^/^-this is a multili 2320 | range: [1x1 3x2] 2321 | type: string! 2322 | upper: [1x1 11x1] 2323 | ] 2324 | [ 2325 | expr: {^/^-hello {"1"} world 2326 | range: [4x1 6x2] 2327 | type: string! 2328 | upper: [1x1 11x1] 2329 | ] 2330 | [ 2331 | expr: {{}^}"} 2332 | range: [7x1 7x9] 2333 | type: string! 2334 | upper: [1x1 11x1] 2335 | ] 2336 | [ 2337 | expr: "{{{{match}}}}" 2338 | range: [8x1 8x16] 2339 | type: string! 2340 | upper: [1x1 11x1] 2341 | ] 2342 | [ 2343 | expr: "not {{{{match}}}}" 2344 | range: [9x1 9x20] 2345 | type: string! 2346 | upper: [1x1 11x1] 2347 | ] 2348 | [ 2349 | range: [9x20 9x21] 2350 | type: string! 2351 | upper: [1x1 11x1] 2352 | error: [code only-closed] 2353 | ] 2354 | [ 2355 | range: [10x1 11x1] 2356 | type: string! 2357 | upper: [1x1 11x1] 2358 | error: [code only-opened at 0] 2359 | ] 2360 | ] 2361 | source: {^{^/^-this i 2362 | lines: [ 2363 | {^{^/^-this i 2364 | 1 2365 | 3 2366 | 32 2367 | 34 2368 | 36 2369 | 60 2370 | 62 2371 | 71 2372 | 87 2373 | 108 2374 | 127 2375 | ] 2376 | ] 2377 | ] 2378 | ================================================ 2379 | end %mstring.txt 2380 | 2381 | begin %number.txt 2382 | ================================================ 2383 | 2384 | [ 2385 | [ 2386 | range: [1x1 7x1] 2387 | nested: 2388 | [ 2389 | [ 2390 | expr: 123 2391 | range: [1x1 1x4] 2392 | type: integer! 2393 | upper: [1x1 7x1] 2394 | ] 2395 | [ 2396 | range: [2x1 2x4] 2397 | type: integer! 2398 | upper: [1x1 7x1] 2399 | error: [code unknown] 2400 | ] 2401 | [ 2402 | expr: abc 2403 | range: [2x4 2x7] 2404 | type: word! 2405 | upper: [1x1 7x1] 2406 | ] 2407 | [ 2408 | expr: 123.0 2409 | range: [3x1 3x6] 2410 | type: float! 2411 | upper: [1x1 7x1] 2412 | ] 2413 | [ 2414 | expr: 123000.0 2415 | range: [4x1 4x6] 2416 | type: float! 2417 | upper: [1x1 7x1] 2418 | ] 2419 | [ 2420 | expr: 0.000123 2421 | range: [5x1 5x8] 2422 | type: float! 2423 | upper: [1x1 7x1] 2424 | ] 2425 | [ 2426 | expr: 123000.0 2427 | range: [6x1 6x8] 2428 | type: float! 2429 | upper: [1x1 7x1] 2430 | ] 2431 | ] 2432 | source: "123^/123ab 2433 | lines: [ 2434 | "123^/123ab 2435 | 1 2436 | 5 2437 | 12 2438 | 18 2439 | 24 2440 | 32 2441 | 40 2442 | ] 2443 | ] 2444 | ] 2445 | ================================================ 2446 | end %number.txt 2447 | 2448 | begin %path.txt 2449 | ================================================ 2450 | 2451 | [ 2452 | [ 2453 | range: [1x1 25x1] 2454 | nested: 2455 | [ 2456 | [ 2457 | range: [1x1 1x6] 2458 | type: path! 2459 | nested: 2460 | [ 2461 | [ 2462 | expr: a 2463 | range: [1x1 1x2] 2464 | type: word! 2465 | upper: [1x1 1x6] 2466 | ] 2467 | [ 2468 | expr: b 2469 | range: [1x3 1x4] 2470 | type: word! 2471 | upper: [1x1 1x6] 2472 | ] 2473 | [ 2474 | expr: c 2475 | range: [1x5 1x6] 2476 | type: word! 2477 | upper: [1x1 1x6] 2478 | ] 2479 | ] 2480 | upper: [1x1 25x1] 2481 | ] 2482 | [ 2483 | range: [2x1 2x10] 2484 | type: lit-path! 2485 | nested: 2486 | [ 2487 | [ 2488 | expr: a 2489 | range: [2x2 2x3] 2490 | type: word! 2491 | upper: [2x1 2x10] 2492 | ] 2493 | [ 2494 | expr: bc 2495 | range: [2x4 2x6] 2496 | type: word! 2497 | upper: [2x1 2x10] 2498 | ] 2499 | [ 2500 | expr: def 2501 | range: [2x7 2x10] 2502 | type: word! 2503 | upper: [2x1 2x10] 2504 | ] 2505 | ] 2506 | upper: [1x1 25x1] 2507 | ] 2508 | [ 2509 | range: [3x1 3x10] 2510 | type: get-path! 2511 | nested: 2512 | [ 2513 | [ 2514 | expr: abc 2515 | range: [3x2 3x5] 2516 | type: word! 2517 | upper: [3x1 3x10] 2518 | ] 2519 | [ 2520 | expr: de 2521 | range: [3x6 3x8] 2522 | type: word! 2523 | upper: [3x1 3x10] 2524 | ] 2525 | [ 2526 | expr: f 2527 | range: [3x9 3x10] 2528 | type: word! 2529 | upper: [3x1 3x10] 2530 | ] 2531 | ] 2532 | upper: [1x1 25x1] 2533 | ] 2534 | [ 2535 | range: [4x1 4x13] 2536 | type: set-path! 2537 | nested: 2538 | [ 2539 | [ 2540 | expr: abc 2541 | range: [4x1 4x4] 2542 | type: word! 2543 | upper: [4x1 4x13] 2544 | ] 2545 | [ 2546 | expr: def 2547 | range: [4x5 4x8] 2548 | type: word! 2549 | upper: [4x1 4x13] 2550 | ] 2551 | [ 2552 | expr: ghi 2553 | range: [4x9 4x12] 2554 | type: word! 2555 | upper: [4x1 4x13] 2556 | ] 2557 | ] 2558 | upper: [1x1 25x1] 2559 | ] 2560 | [ 2561 | range: [5x1 5x15] 2562 | type: path! 2563 | nested: 2564 | [ 2565 | [ 2566 | expr: a^b 2567 | range: [5x1 5x4] 2568 | type: word! 2569 | upper: [5x1 5x15] 2570 | ] 2571 | [ 2572 | expr: c^^d 2573 | range: [5x5 5x9] 2574 | type: word! 2575 | upper: [5x1 5x15] 2576 | ] 2577 | [ 2578 | expr: e^^^f 2579 | range: [5x10 5x15] 2580 | type: word! 2581 | upper: [5x1 5x15] 2582 | ] 2583 | ] 2584 | upper: [1x1 25x1] 2585 | ] 2586 | [ 2587 | range: [6x1 6x10] 2588 | type: path! 2589 | nested: 2590 | [ 2591 | [ 2592 | expr: a 2593 | range: [6x1 6x2] 2594 | type: word! 2595 | upper: [6x1 6x10] 2596 | ] 2597 | [ 2598 | expr: b 2599 | range: [6x3 6x4] 2600 | type: word! 2601 | upper: [6x1 6x10] 2602 | ] 2603 | [ 2604 | range: [6x5 6x10] 2605 | type: paren! 2606 | nested: 2607 | [ 2608 | [ 2609 | expr: var 2610 | range: [6x6 6x9] 2611 | type: word! 2612 | upper: [6x5 6x10] 2613 | ] 2614 | ] 2615 | upper: [6x1 6x10] 2616 | ] 2617 | ] 2618 | upper: [1x1 25x1] 2619 | ] 2620 | [ 2621 | range: [7x1 7x12] 2622 | type: path! 2623 | nested: 2624 | [ 2625 | [ 2626 | expr: a 2627 | range: [7x1 7x2] 2628 | type: word! 2629 | upper: [7x1 7x12] 2630 | ] 2631 | [ 2632 | expr: b 2633 | range: [7x3 7x4] 2634 | type: word! 2635 | upper: [7x1 7x12] 2636 | ] 2637 | [ 2638 | range: [7x5 7x12] 2639 | type: paren! 2640 | nested: 2641 | [ 2642 | [ 2643 | expr: 1 2644 | range: [7x6 7x7] 2645 | type: integer! 2646 | upper: [7x5 7x12] 2647 | ] 2648 | [ 2649 | expr: + 2650 | range: [7x8 7x9] 2651 | type: word! 2652 | upper: [7x5 7x12] 2653 | ] 2654 | [ 2655 | expr: 2 2656 | range: [7x10 7x11] 2657 | type: integer! 2658 | upper: [7x5 7x12] 2659 | ] 2660 | ] 2661 | upper: [7x1 7x12] 2662 | ] 2663 | ] 2664 | upper: [1x1 25x1] 2665 | ] 2666 | [ 2667 | range: [8x1 8x13] 2668 | type: set-path! 2669 | nested: 2670 | [ 2671 | [ 2672 | expr: a 2673 | range: [8x1 8x2] 2674 | type: word! 2675 | upper: [8x1 8x13] 2676 | ] 2677 | [ 2678 | expr: b 2679 | range: [8x3 8x4] 2680 | type: word! 2681 | upper: [8x1 8x13] 2682 | ] 2683 | [ 2684 | range: [8x5 8x12] 2685 | type: paren! 2686 | nested: 2687 | [ 2688 | [ 2689 | expr: 1 2690 | range: [8x6 8x7] 2691 | type: integer! 2692 | upper: [8x5 8x12] 2693 | ] 2694 | [ 2695 | expr: + 2696 | range: [8x8 8x9] 2697 | type: word! 2698 | upper: [8x5 8x12] 2699 | ] 2700 | [ 2701 | expr: 2 2702 | range: [8x10 8x11] 2703 | type: integer! 2704 | upper: [8x5 8x12] 2705 | ] 2706 | ] 2707 | upper: [8x1 8x13] 2708 | ] 2709 | ] 2710 | upper: [1x1 25x1] 2711 | ] 2712 | [ 2713 | range: [9x1 9x13] 2714 | type: get-path! 2715 | nested: 2716 | [ 2717 | [ 2718 | expr: a 2719 | range: [9x2 9x3] 2720 | type: word! 2721 | upper: [9x1 9x13] 2722 | ] 2723 | [ 2724 | expr: b 2725 | range: [9x4 9x5] 2726 | type: word! 2727 | upper: [9x1 9x13] 2728 | ] 2729 | [ 2730 | range: [9x6 9x13] 2731 | type: paren! 2732 | nested: 2733 | [ 2734 | [ 2735 | expr: 1 2736 | range: [9x7 9x8] 2737 | type: integer! 2738 | upper: [9x6 9x13] 2739 | ] 2740 | [ 2741 | expr: + 2742 | range: [9x9 9x10] 2743 | type: word! 2744 | upper: [9x6 9x13] 2745 | ] 2746 | [ 2747 | expr: 2 2748 | range: [9x11 9x12] 2749 | type: integer! 2750 | upper: [9x6 9x13] 2751 | ] 2752 | ] 2753 | upper: [9x1 9x13] 2754 | ] 2755 | ] 2756 | upper: [1x1 25x1] 2757 | ] 2758 | [ 2759 | range: [10x1 10x13] 2760 | type: lit-path! 2761 | nested: 2762 | [ 2763 | [ 2764 | expr: a 2765 | range: [10x2 10x3] 2766 | type: word! 2767 | upper: [10x1 10x13] 2768 | ] 2769 | [ 2770 | expr: b 2771 | range: [10x4 10x5] 2772 | type: word! 2773 | upper: [10x1 10x13] 2774 | ] 2775 | [ 2776 | range: [10x6 10x13] 2777 | type: paren! 2778 | nested: 2779 | [ 2780 | [ 2781 | expr: 1 2782 | range: [10x7 10x8] 2783 | type: integer! 2784 | upper: [10x6 10x13] 2785 | ] 2786 | [ 2787 | expr: + 2788 | range: [10x9 10x10] 2789 | type: word! 2790 | upper: [10x6 10x13] 2791 | ] 2792 | [ 2793 | expr: 2 2794 | range: [10x11 10x12] 2795 | type: integer! 2796 | upper: [10x6 10x13] 2797 | ] 2798 | ] 2799 | upper: [10x1 10x13] 2800 | ] 2801 | ] 2802 | upper: [1x1 25x1] 2803 | ] 2804 | [ 2805 | range: [11x1 11x12] 2806 | type: path! 2807 | nested: 2808 | [ 2809 | [ 2810 | expr: a 2811 | range: [11x1 11x2] 2812 | type: word! 2813 | upper: [11x1 11x12] 2814 | ] 2815 | [ 2816 | expr: b 2817 | range: [11x3 11x4] 2818 | type: word! 2819 | upper: [11x1 11x12] 2820 | ] 2821 | [ 2822 | range: [11x5 11x10] 2823 | type: paren! 2824 | nested: 2825 | [ 2826 | [ 2827 | expr: var 2828 | range: [11x6 11x9] 2829 | type: word! 2830 | upper: [11x5 11x10] 2831 | ] 2832 | ] 2833 | upper: [11x1 11x12] 2834 | ] 2835 | [ 2836 | expr: 1 2837 | range: [11x11 11x12] 2838 | type: integer! 2839 | upper: [11x1 11x12] 2840 | ] 2841 | ] 2842 | upper: [1x1 25x1] 2843 | ] 2844 | [ 2845 | range: [12x1 12x22] 2846 | type: path! 2847 | nested: 2848 | [ 2849 | [ 2850 | expr: a 2851 | range: [12x1 12x2] 2852 | type: word! 2853 | upper: [12x1 12x22] 2854 | ] 2855 | [ 2856 | expr: b 2857 | range: [12x3 12x4] 2858 | type: word! 2859 | upper: [12x1 12x22] 2860 | ] 2861 | [ 2862 | range: [12x5 12x22] 2863 | type: paren! 2864 | nested: 2865 | [ 2866 | [ 2867 | expr: a 2868 | range: [12x6 12x7] 2869 | type: word! 2870 | upper: [12x5 12x22] 2871 | ] 2872 | [ 2873 | expr: + 2874 | range: [12x8 12x9] 2875 | type: word! 2876 | upper: [12x5 12x22] 2877 | ] 2878 | [ 2879 | range: [12x10 12x21] 2880 | type: path! 2881 | nested: 2882 | [ 2883 | [ 2884 | expr: b 2885 | range: [12x10 12x11] 2886 | type: word! 2887 | upper: [12x10 12x21] 2888 | ] 2889 | [ 2890 | range: [12x12 12x21] 2891 | type: paren! 2892 | nested: 2893 | [ 2894 | [ 2895 | expr: c 2896 | range: [12x13 12x14] 2897 | type: word! 2898 | upper: [12x12 12x21] 2899 | ] 2900 | [ 2901 | range: [12x15 12x20] 2902 | type: block! 2903 | nested: 2904 | [ 2905 | [ 2906 | expr: e 2907 | range: [12x16 12x17] 2908 | type: word! 2909 | upper: [12x15 12x20] 2910 | ] 2911 | [ 2912 | expr: f 2913 | range: [12x18 12x19] 2914 | type: word! 2915 | upper: [12x15 12x20] 2916 | ] 2917 | ] 2918 | upper: [12x12 12x21] 2919 | ] 2920 | ] 2921 | upper: [12x10 12x21] 2922 | ] 2923 | ] 2924 | upper: [12x5 12x22] 2925 | ] 2926 | ] 2927 | upper: [12x1 12x22] 2928 | ] 2929 | ] 2930 | upper: [1x1 25x1] 2931 | ] 2932 | [ 2933 | range: [13x1 13x9] 2934 | type: path! 2935 | nested: 2936 | [ 2937 | [ 2938 | expr: a 2939 | range: [13x1 13x2] 2940 | type: word! 2941 | upper: [13x1 13x9] 2942 | ] 2943 | [ 2944 | expr: b 2945 | range: [13x3 13x4] 2946 | type: word! 2947 | upper: [13x1 13x9] 2948 | ] 2949 | [ 2950 | expr: 2.34 2951 | range: [13x5 13x9] 2952 | type: float! 2953 | upper: [13x1 13x9] 2954 | ] 2955 | ] 2956 | upper: [1x1 25x1] 2957 | ] 2958 | [ 2959 | range: [14x1 14x5] 2960 | type: path! 2961 | nested: 2962 | [ 2963 | [ 2964 | expr: a 2965 | range: [14x1 14x2] 2966 | type: word! 2967 | upper: [14x1 14x5] 2968 | ] 2969 | [ 2970 | expr: 'b 2971 | range: [14x3 14x5] 2972 | type: lit-word! 2973 | upper: [14x1 14x5] 2974 | ] 2975 | ] 2976 | upper: [1x1 25x1] 2977 | ] 2978 | [ 2979 | range: [15x1 15x5] 2980 | type: path! 2981 | nested: 2982 | [ 2983 | [ 2984 | expr: a 2985 | range: [15x1 15x2] 2986 | type: word! 2987 | upper: [15x1 15x5] 2988 | ] 2989 | [ 2990 | expr: :b 2991 | range: [15x3 15x5] 2992 | type: get-word! 2993 | upper: [15x1 15x5] 2994 | ] 2995 | ] 2996 | upper: [1x1 25x1] 2997 | ] 2998 | [ 2999 | range: [17x1 17x5] 3000 | type: path! 3001 | nested: 3002 | [ 3003 | [ 3004 | expr: a 3005 | range: [17x1 17x2] 3006 | type: word! 3007 | upper: [17x1 17x5] 3008 | ] 3009 | [ 3010 | expr: b 3011 | range: [17x3 17x4] 3012 | type: word! 3013 | upper: [17x1 17x5] 3014 | ] 3015 | ] 3016 | upper: [1x1 25x1] 3017 | error: [code slash] 3018 | ] 3019 | [ 3020 | range: [17x5 17x7] 3021 | type: block! 3022 | upper: [1x1 25x1] 3023 | ] 3024 | [ 3025 | range: [18x1 18x5] 3026 | type: path! 3027 | nested: 3028 | [ 3029 | [ 3030 | expr: a 3031 | range: [18x1 18x2] 3032 | type: word! 3033 | upper: [18x1 18x5] 3034 | ] 3035 | [ 3036 | expr: b 3037 | range: [18x3 18x4] 3038 | type: word! 3039 | upper: [18x1 18x5] 3040 | ] 3041 | ] 3042 | upper: [1x1 25x1] 3043 | error: [code slash] 3044 | ] 3045 | [ 3046 | range: [19x1 19x7] 3047 | type: lit-path! 3048 | nested: 3049 | [ 3050 | [ 3051 | expr: a 3052 | range: [19x2 19x3] 3053 | type: word! 3054 | upper: [19x1 19x7] 3055 | ] 3056 | [ 3057 | expr: bc 3058 | range: [19x4 19x6] 3059 | type: word! 3060 | upper: [19x1 19x7] 3061 | ] 3062 | ] 3063 | upper: [1x1 25x1] 3064 | error: [code slash] 3065 | ] 3066 | [ 3067 | range: [20x1 20x9] 3068 | type: get-path! 3069 | nested: 3070 | [ 3071 | [ 3072 | expr: abc 3073 | range: [20x2 20x5] 3074 | type: word! 3075 | upper: [20x1 20x9] 3076 | ] 3077 | [ 3078 | expr: de 3079 | range: [20x6 20x8] 3080 | type: word! 3081 | upper: [20x1 20x9] 3082 | ] 3083 | ] 3084 | upper: [1x1 25x1] 3085 | error: [code slash] 3086 | ] 3087 | [ 3088 | range: [21x1 21x10] 3089 | type: path! 3090 | nested: 3091 | [ 3092 | [ 3093 | expr: abc 3094 | range: [21x1 21x4] 3095 | type: word! 3096 | upper: [21x1 21x10] 3097 | ] 3098 | [ 3099 | expr: def 3100 | range: [21x5 21x8] 3101 | type: word! 3102 | upper: [21x1 21x10] 3103 | ] 3104 | ] 3105 | upper: [1x1 25x1] 3106 | error: [code word! expr ":"] 3107 | ] 3108 | [ 3109 | range: [22x1 22x6] 3110 | type: path! 3111 | nested: 3112 | [ 3113 | [ 3114 | expr: a 3115 | range: [22x1 22x2] 3116 | type: word! 3117 | upper: [22x1 22x6] 3118 | ] 3119 | [ 3120 | expr: b 3121 | range: [22x3 22x4] 3122 | type: word! 3123 | upper: [22x1 22x6] 3124 | ] 3125 | ] 3126 | upper: [1x1 25x1] 3127 | error: [code word! expr "c"] 3128 | ] 3129 | [ 3130 | expr: :d 3131 | range: [22x6 22x8] 3132 | type: get-word! 3133 | upper: [1x1 25x1] 3134 | ] 3135 | [ 3136 | range: [23x1 23x7] 3137 | type: set-path! 3138 | nested: 3139 | [ 3140 | [ 3141 | expr: a 3142 | range: [23x1 23x2] 3143 | type: word! 3144 | upper: [23x1 23x7] 3145 | ] 3146 | [ 3147 | expr: b 3148 | range: [23x3 23x4] 3149 | type: word! 3150 | upper: [23x1 23x7] 3151 | ] 3152 | [ 3153 | expr: 1 3154 | range: [23x5 23x6] 3155 | type: integer! 3156 | upper: [23x1 23x7] 3157 | ] 3158 | ] 3159 | upper: [1x1 25x1] 3160 | ] 3161 | [ 3162 | expr: 2 3163 | range: [23x7 23x8] 3164 | type: integer! 3165 | upper: [1x1 25x1] 3166 | ] 3167 | [ 3168 | range: [24x1 24x10] 3169 | type: path! 3170 | nested: 3171 | [ 3172 | [ 3173 | expr: abc 3174 | range: [24x1 24x4] 3175 | type: word! 3176 | upper: [24x1 24x10] 3177 | ] 3178 | [ 3179 | expr: def 3180 | range: [24x5 24x8] 3181 | type: word! 3182 | upper: [24x1 24x10] 3183 | ] 3184 | ] 3185 | upper: [1x1 25x1] 3186 | error: [code word! expr "'"] 3187 | ] 3188 | ] 3189 | source: {a/b/c^/'a/ 3190 | lines: [ 3191 | {a/b/c^/'a/ 3192 | 1 3193 | 7 3194 | 17 3195 | 27 3196 | 40 3197 | 55 3198 | 65 3199 | 77 3200 | 90 3201 | 103 3202 | 116 3203 | 128 3204 | 150 3205 | 159 3206 | 164 3207 | 169 3208 | 170 3209 | 177 3210 | 182 3211 | 189 3212 | 198 3213 | 208 3214 | 216 3215 | 224 3216 | 234 3217 | ] 3218 | ] 3219 | ] 3220 | ================================================ 3221 | end %path.txt 3222 | 3223 | begin %rstring.txt 3224 | ================================================ 3225 | 3226 | [ 3227 | [ 3228 | range: [1x1 12x1] 3229 | nested: 3230 | [ 3231 | [ 3232 | expr: "^/^-{^^any string! is 3233 | range: [1x1 3x3] 3234 | type: string! 3235 | upper: [1x1 12x1] 3236 | ] 3237 | [ 3238 | expr: "haha" 3239 | range: [4x1 4x11] 3240 | type: string! 3241 | upper: [1x1 12x1] 3242 | ] 3243 | [ 3244 | range: [5x1 7x5] 3245 | type: string! 3246 | upper: [1x1 12x1] 3247 | error: [code only-opened at 0] 3248 | ] 3249 | [ 3250 | range: [9x1 11x3] 3251 | type: string! 3252 | upper: [1x1 12x1] 3253 | error: [code only-opened at 0] 3254 | ] 3255 | ] 3256 | source: {%^{^/^-^{^^any 3257 | lines: [ 3258 | {%^{^/^-^{^^any 3259 | 1 3260 | 4 3261 | 40 3262 | 43 3263 | 54 3264 | 58 3265 | 67 3266 | 72 3267 | 73 3268 | 77 3269 | 86 3270 | 89 3271 | ] 3272 | ] 3273 | ] 3274 | ================================================ 3275 | end %rstring.txt 3276 | 3277 | begin %string.txt 3278 | ================================================ 3279 | 3280 | [ 3281 | [ 3282 | range: [1x1 10x1] 3283 | nested: 3284 | [ 3285 | [ 3286 | expr: "this is a string!" 3287 | range: [1x1 1x20] 3288 | type: string! 3289 | upper: [1x1 10x1] 3290 | ] 3291 | [ 3292 | expr: "中文字符" 3293 | range: [2x1 2x7] 3294 | type: string! 3295 | upper: [1x1 10x1] 3296 | ] 3297 | [ 3298 | expr: "hello ^/1 world!" 3299 | range: [3x1 3x23] 3300 | type: string! 3301 | upper: [1x1 10x1] 3302 | ] 3303 | [ 3304 | expr: {"ha ha"} 3305 | range: [4x1 4x12] 3306 | type: string! 3307 | upper: [1x1 10x1] 3308 | ] 3309 | [ 3310 | expr: "test open {[(<" 3311 | range: [5x1 5x17] 3312 | type: string! 3313 | upper: [1x1 10x1] 3314 | ] 3315 | [ 3316 | expr: "test close }])>" 3317 | range: [6x1 6x18] 3318 | type: string! 3319 | upper: [1x1 10x1] 3320 | ] 3321 | [ 3322 | range: [7x1 7x18] 3323 | type: string! 3324 | upper: [1x1 10x1] 3325 | error: [code only-opened at 7] 3326 | ] 3327 | [ 3328 | range: [8x1 8x7] 3329 | type: string! 3330 | upper: [1x1 10x1] 3331 | error: [code only-opened at 0] 3332 | ] 3333 | [ 3334 | expr: newline 3335 | range: [9x1 9x8] 3336 | type: word! 3337 | upper: [1x1 10x1] 3338 | ] 3339 | [ 3340 | range: [9x8 9x9] 3341 | type: string! 3342 | upper: [1x1 10x1] 3343 | error: [code only-opened at 0] 3344 | ] 3345 | ] 3346 | source: {"this is 3347 | lines: [ 3348 | {"this is 3349 | 1 3350 | 21 3351 | 28 3352 | 51 3353 | 63 3354 | 80 3355 | 98 3356 | 116 3357 | 123 3358 | 132 3359 | ] 3360 | ] 3361 | ] 3362 | ================================================ 3363 | end %string.txt 3364 | 3365 | begin %tag.txt 3366 | ================================================ 3367 | 3368 | [ 3369 | [ 3370 | range: [1x1 7x1] 3371 | nested: 3372 | [ 3373 | [ 3374 | expr: 3375 | range: [1x1 1x17] 3376 | type: tag! 3377 | upper: [1x1 7x1] 3378 | ] 3379 | [ 3380 | expr: 3387 | range: [4x1 4x10] 3388 | type: tag! 3389 | upper: [1x1 7x1] 3390 | ] 3391 | [ 3392 | expr: > 3393 | range: [4x10 4x11] 3394 | type: word! 3395 | upper: [1x1 7x1] 3396 | ] 3397 | [ 3398 | expr: < 3399 | range: [5x1 5x2] 3400 | type: word! 3401 | upper: [1x1 7x1] 3402 | ] 3403 | [ 3404 | range: [6x1 7x1] 3405 | type: tag! 3406 | upper: [1x1 7x1] 3407 | error: [code unknown] 3408 | ] 3409 | ] 3410 | source: {