modern: more forms

modern-harvey3
Doug Coleman 2019-02-17 15:21:26 -06:00
parent bcb0bf8a53
commit b612b5be8c
2 changed files with 41 additions and 2 deletions

View File

@ -1,6 +1,7 @@
! Copyright (C) 2017 Doug Coleman. ! Copyright (C) 2017 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: modern modern.slices multiline tools.test ; USING: kernel modern modern.out modern.slices multiline
sequences tools.test ;
IN: modern.tests IN: modern.tests
{ f } [ "" upper-colon? ] unit-test { f } [ "" upper-colon? ] unit-test

View File

@ -1,7 +1,7 @@
! Copyright (C) 2016 Doug Coleman. ! Copyright (C) 2016 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: arrays assocs combinators combinators.short-circuit USING: arrays assocs combinators combinators.short-circuit
continuations io.encodings.utf8 io.files kernel make math constructors continuations io.encodings.utf8 io.files kernel make math
math.order modern.paths modern.slices sequences sequences.extras math.order modern.paths modern.slices sequences sequences.extras
sequences.generalizations sets shuffle splitting strings sequences.generalizations sets shuffle splitting strings
syntax.modern unicode vocabs.loader ; syntax.modern unicode vocabs.loader ;
@ -10,6 +10,44 @@ IN: modern
ERROR: string-expected-got-eof n string ; ERROR: string-expected-got-eof n string ;
ERROR: long-opening-mismatch tag open n string ch ; ERROR: long-opening-mismatch tag open n string ch ;
TUPLE: lexed tokens ;
TUPLE: bracket < lexed tag payload ;
CONSTRUCTOR: <bracket> bracket ( tag payload -- obj ) ;
TUPLE: dbracket < lexed tag payload ;
CONSTRUCTOR: <dbracket> dbracket ( tag payload -- obj ) ;
TUPLE: brace < lexed tag payload ;
CONSTRUCTOR: <brace> brace ( tag payload -- obj ) ;
TUPLE: dbrace < lexed tag payload ;
CONSTRUCTOR: <dbrace> dbrace ( tag payload -- obj ) ;
TUPLE: lcolon < lexed tag payload ;
CONSTRUCTOR: <lcolon> lcolon ( tag payload -- obj ) ;
TUPLE: ucolon < lexed name effect body ;
CONSTRUCTOR: <ucolon> ucolon ( name effect body -- obj ) ;
TUPLE: dquote < lexed tag payload ;
CONSTRUCTOR: <dquote> dquote ( tag payload -- obj ) ;
TUPLE: section < lexed payload ;
CONSTRUCTOR: <section> section ( payload -- obj ) ;
TUPLE: named-section < lexed name payload ;
CONSTRUCTOR: <named-section> named-section ( name payload -- obj ) ;
TUPLE: backslash < lexed object ;
CONSTRUCTOR: <backslash> backslash ( object -- obj ) ;
TUPLE: hashtag < lexed object ;
CONSTRUCTOR: <hashtag> hashtag ( object -- obj ) ;
TUPLE: token < lexed name ;
CONSTRUCTOR: <token> token ( name -- obj ) ;
! (( )) [[ ]] {{ }} ! (( )) [[ ]] {{ }}
MACRO:: read-double-matched ( open-ch -- quot: ( n string tag ch -- n' string seq ) ) MACRO:: read-double-matched ( open-ch -- quot: ( n string tag ch -- n' string seq ) )
open-ch dup matching-delimiter { open-ch dup matching-delimiter {