uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 23a514b3ba66735814a8cf51f5f8a701796a16de
parent 86674da93ebf89c7eb52420990593fc6846ce526
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date:   Wed, 29 Dec 2021 11:59:20 +0000

Support nested comments in asma too.

Diffstat:
Metc/asma.lua | 3++-
Metc/asma.moon | 3++-
Mprojects/library/asma.tal | 10+++++++++-
3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/etc/asma.lua b/etc/asma.lua @@ -89,7 +89,8 @@ do ['}'] = 'asma-macro-end' }) process('asma-first-char-comment', { - [')'] = 'asma-comment-end' + ['('] = 'asma-comment-more', + [')'] = 'asma-comment-less' }) end local traverse_node diff --git a/etc/asma.moon b/etc/asma.moon @@ -87,7 +87,8 @@ do -- first characters '{': 'asma-ignore' '}': 'asma-macro-end' process 'asma-first-char-comment', - ')': 'asma-comment-end' + '(': 'asma-comment-more' + ')': 'asma-comment-less' traverse_node = (t, min, max, lefts, rights) -> i = math.ceil (min + max) / 2 diff --git a/projects/library/asma.tal b/projects/library/asma.tal @@ -347,6 +347,7 @@ @asma [ &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 &addr $2 &written-addr $2 &flush-fn $2 &src-filename $2 &dest-filename $2 @@ -610,11 +611,17 @@ %asma-STATE-SET { ;asma/state LDA ORA ;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-level LDAk INC ROT ROT STA #02 asma-STATE-SET @asma-ignore 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 #02 asma-STATE-CLEAR JMP2r @@ -908,7 +915,8 @@ than than string data ) @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 &28 $2 $2 '( 00 :asma-comment-start