mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-27 00:03:00 +00:00
Support nested comments in asma too.
This commit is contained in:
parent
86674da93e
commit
23a514b3ba
3 changed files with 13 additions and 3 deletions
|
@ -89,7 +89,8 @@ do
|
||||||
['}'] = 'asma-macro-end'
|
['}'] = 'asma-macro-end'
|
||||||
})
|
})
|
||||||
process('asma-first-char-comment', {
|
process('asma-first-char-comment', {
|
||||||
[')'] = 'asma-comment-end'
|
['('] = 'asma-comment-more',
|
||||||
|
[')'] = 'asma-comment-less'
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
local traverse_node
|
local traverse_node
|
||||||
|
|
|
@ -87,7 +87,8 @@ do -- first characters
|
||||||
'{': 'asma-ignore'
|
'{': 'asma-ignore'
|
||||||
'}': 'asma-macro-end'
|
'}': 'asma-macro-end'
|
||||||
process 'asma-first-char-comment',
|
process 'asma-first-char-comment',
|
||||||
')': 'asma-comment-end'
|
'(': 'asma-comment-more'
|
||||||
|
')': 'asma-comment-less'
|
||||||
|
|
||||||
traverse_node = (t, min, max, lefts, rights) ->
|
traverse_node = (t, min, max, lefts, rights) ->
|
||||||
i = math.ceil (min + max) / 2
|
i = math.ceil (min + max) / 2
|
||||||
|
|
|
@ -347,6 +347,7 @@
|
||||||
|
|
||||||
@asma [
|
@asma [
|
||||||
&pass $1 &state $1 &line $2 &lines $2 &break $1 &eof $1
|
&pass $1 &state $1 &line $2 &lines $2 &break $1 &eof $1
|
||||||
|
&comment-level $1
|
||||||
&token $2 &orig-token $2 &lit $1 &lit-present $1
|
&token $2 &orig-token $2 &lit $1 &lit-present $1
|
||||||
&addr $2 &written-addr $2 &flush-fn $2
|
&addr $2 &written-addr $2 &flush-fn $2
|
||||||
&src-filename $2 &dest-filename $2
|
&src-filename $2 &dest-filename $2
|
||||||
|
@ -610,11 +611,17 @@
|
||||||
%asma-STATE-SET { ;asma/state LDA ORA ;asma/state STA }
|
%asma-STATE-SET { ;asma/state LDA ORA ;asma/state STA }
|
||||||
%asma-STATE-CLEAR { #ff EOR ;asma/state LDA AND ;asma/state STA }
|
%asma-STATE-CLEAR { #ff EOR ;asma/state LDA AND ;asma/state STA }
|
||||||
|
|
||||||
|
@asma-comment-more
|
||||||
|
;asma/token LDA2 ;strlen JSR2 ORA ,asma-ignore JCN
|
||||||
@asma-comment-start
|
@asma-comment-start
|
||||||
|
;asma/comment-level LDAk INC ROT ROT STA
|
||||||
#02 asma-STATE-SET
|
#02 asma-STATE-SET
|
||||||
@asma-ignore
|
@asma-ignore
|
||||||
JMP2r
|
JMP2r
|
||||||
|
|
||||||
|
@asma-comment-less
|
||||||
|
;asma/token LDA2 ;strlen JSR2 ORA ,asma-ignore JCN
|
||||||
|
;asma/comment-level LDAk #01 SUB DUP SWP2 STA ,asma-ignore JCN
|
||||||
@asma-comment-end
|
@asma-comment-end
|
||||||
#02 asma-STATE-CLEAR
|
#02 asma-STATE-CLEAR
|
||||||
JMP2r
|
JMP2r
|
||||||
|
@ -908,7 +915,8 @@
|
||||||
than than string data )
|
than than string data )
|
||||||
|
|
||||||
@asma-first-char-comment
|
@asma-first-char-comment
|
||||||
&_entry $2 $2 ') 00 :asma-comment-end
|
&28 $2 $2 '( 00 :asma-comment-more
|
||||||
|
&_entry :&28 $2 ') 00 :asma-comment-less
|
||||||
|
|
||||||
@asma-first-char-macro
|
@asma-first-char-macro
|
||||||
&28 $2 $2 '( 00 :asma-comment-start
|
&28 $2 $2 '( 00 :asma-comment-start
|
||||||
|
|
Loading…
Reference in a new issue