factor: fix more syntax things
parent
60fde01039
commit
e6aedf0d4c
|
@ -1,6 +1,7 @@
|
||||||
! Copyright (C) 2008 Slava Pestov.
|
! Copyright (C) 2008 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: layouts kernel parser math math.bitwise sequences ;
|
USING: layouts kernel parser math math.bitwise sequences
|
||||||
|
literals ;
|
||||||
IN: persistent.hashtables.config
|
IN: persistent.hashtables.config
|
||||||
|
|
||||||
CONSTANT: radix-bits $[ cell 4 = 4 5 ? ] ;
|
CONSTANT: radix-bits $[ cell 4 = 4 5 ? ] ;
|
||||||
|
|
|
@ -506,7 +506,7 @@ COMPILE<
|
||||||
[ [ delimiter>> ] [ generator>> 1quotation ] bi ] { } map>assoc ;
|
[ [ delimiter>> ] [ generator>> 1quotation ] bi ] { } map>assoc ;
|
||||||
COMPILE>
|
COMPILE>
|
||||||
|
|
||||||
! 0 "HI: ;" slice-til-either -> 3 "HI: ;" "HI:" CHAR: \:
|
! 0 "HI: ;" slice-til-either -> 3 "HI: ;" "HI:" char: \:
|
||||||
MACRO: rules>call-lexer ( seq -- quot: ( lexer string -- literal ) )
|
MACRO: rules>call-lexer ( seq -- quot: ( lexer string -- literal ) )
|
||||||
[ lexer-rules>delimiters ]
|
[ lexer-rules>delimiters ]
|
||||||
[
|
[
|
||||||
|
|
|
@ -5,7 +5,7 @@ byte-arrays classes.struct combinators constructors
|
||||||
continuations destructors forestdb.ffi forestdb.paths fry
|
continuations destructors forestdb.ffi forestdb.paths fry
|
||||||
generalizations io.encodings.string io.encodings.utf8
|
generalizations io.encodings.string io.encodings.utf8
|
||||||
io.pathnames kernel libc math namespaces sequences
|
io.pathnames kernel libc math namespaces sequences
|
||||||
strings ;
|
strings io.directories ;
|
||||||
QUALIFIED: sets
|
QUALIFIED: sets
|
||||||
IN: forestdb.lib
|
IN: forestdb.lib
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,8 @@ general parsers work and the 'list of sucesses' that are returned as a
|
||||||
result.</p>
|
result.</p>
|
||||||
<pre class="code">
|
<pre class="code">
|
||||||
(1) : char-a ( inp -- result )
|
(1) : char-a ( inp -- result )
|
||||||
0 over string-nth CHAR: a = [
|
0 over string-nth char: a = [
|
||||||
1 swap string-tail CHAR: a cons unit delay lunit
|
1 swap string-tail char: a cons unit delay lunit
|
||||||
] [
|
] [
|
||||||
drop lnil
|
drop lnil
|
||||||
] ifte ;
|
] ifte ;
|
||||||
|
|
|
@ -48,15 +48,15 @@ Name = !(Keyword) iName => [[ ast-name boa ]]
|
||||||
Number = Digits:ws '.' Digits:fs => [[ ws "." fs 3array "" concat-as string>number ast-number boa ]]
|
Number = Digits:ws '.' Digits:fs => [[ ws "." fs 3array "" concat-as string>number ast-number boa ]]
|
||||||
| Digits => [[ >string string>number ast-number boa ]]
|
| Digits => [[ >string string>number ast-number boa ]]
|
||||||
|
|
||||||
SingleEscape = "b" => [[ CHAR: \b ]]
|
SingleEscape = "b" => [[ char: \b ]]
|
||||||
| "f" => [[ CHAR: \f ]]
|
| "f" => [[ char: \f ]]
|
||||||
| "n" => [[ CHAR: \n ]]
|
| "n" => [[ char: \n ]]
|
||||||
| "r" => [[ CHAR: \r ]]
|
| "r" => [[ char: \r ]]
|
||||||
| "t" => [[ CHAR: \t ]]
|
| "t" => [[ char: \t ]]
|
||||||
| "v" => [[ CHAR: \v ]]
|
| "v" => [[ char: \v ]]
|
||||||
| "'" => [[ CHAR: ' ]]
|
| "'" => [[ char: \' ]]
|
||||||
| "\"" => [[ CHAR: " ]]
|
| "\"" => [[ char: \" ]]
|
||||||
| "\\" => [[ CHAR: \\ ]]
|
| "\\" => [[ char: \\ ]]
|
||||||
HexDigit = [0-9a-fA-F]
|
HexDigit = [0-9a-fA-F]
|
||||||
HexEscape = "x" (HexDigit HexDigit):d => [[ d hex> ]]
|
HexEscape = "x" (HexDigit HexDigit):d => [[ d hex> ]]
|
||||||
UnicodeEscape = "u" (HexDigit HexDigit HexDigit HexDigit):d => [[ d hex> ]]
|
UnicodeEscape = "u" (HexDigit HexDigit HexDigit HexDigit):d => [[ d hex> ]]
|
||||||
|
|
|
@ -34,8 +34,8 @@
|
||||||
HASH_CHAR="USE:"
|
HASH_CHAR="USE:"
|
||||||
AT_WORD_START="TRUE">USE:\s+(\S+)</SEQ_REGEXP>
|
AT_WORD_START="TRUE">USE:\s+(\S+)</SEQ_REGEXP>
|
||||||
<SEQ_REGEXP TYPE="LITERAL2"
|
<SEQ_REGEXP TYPE="LITERAL2"
|
||||||
HASH_CHAR="CHAR:"
|
HASH_CHAR="char:"
|
||||||
AT_WORD_START="TRUE">CHAR:\s+(\S+)</SEQ_REGEXP>
|
AT_WORD_START="TRUE">char:\s+(\S+)</SEQ_REGEXP>
|
||||||
|
|
||||||
<SPAN TYPE="COMMENT3" DELEGATE="STACK_EFFECT" NO_LINE_BREAK="TRUE">
|
<SPAN TYPE="COMMENT3" DELEGATE="STACK_EFFECT" NO_LINE_BREAK="TRUE">
|
||||||
<BEGIN>( </BEGIN>
|
<BEGIN>( </BEGIN>
|
||||||
|
|
|
@ -252,7 +252,7 @@
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>match</key>
|
<key>match</key>
|
||||||
<string>(^|(?<=\s))CHAR:\s+[^\s]+(\s|$)</string>
|
<string>(^|(?<=\s))char:\s+[^\s]+(\s|$)</string>
|
||||||
<key>name</key>
|
<key>name</key>
|
||||||
<string>constant.character.factor</string>
|
<string>constant.character.factor</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
|
|
@ -132,7 +132,7 @@ patterns: [
|
||||||
name: "constant.language.factor"
|
name: "constant.language.factor"
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
match: "(^|(?<=\\s))CHAR:\\s+[^\\s]+(\\s|$)"
|
match: "(^|(?<=\\s))char:\\s+[^\\s]+(\\s|$)"
|
||||||
name: "constant.character.factor"
|
name: "constant.character.factor"
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
|
@ -98,7 +98,7 @@ syn match factorIn /\<IN:\s\+\S\+\>/
|
||||||
syn match factorUse /\<USE:\s\+\S\+\>/
|
syn match factorUse /\<USE:\s\+\S\+\>/
|
||||||
syn match factorUnuse /\<UNUSE:\s\+\S\+\>/
|
syn match factorUnuse /\<UNUSE:\s\+\S\+\>/
|
||||||
|
|
||||||
syn match factorChar /\<CHAR:\s\+\S\+\>/
|
syn match factorChar /\<char:\s\+\S\+\>/
|
||||||
|
|
||||||
syn match factorBackslash /\<\\\>\s\+\S\+\>/
|
syn match factorBackslash /\<\\\>\s\+\S\+\>/
|
||||||
syn match factorMBackslash /\<M\\\>\s\+\S\+\s\+\S\+\>/
|
syn match factorMBackslash /\<M\\\>\s\+\S\+\s\+\S\+\>/
|
||||||
|
|
|
@ -86,7 +86,7 @@ syn match factorIn /\<IN:\s\+\S\+\>/
|
||||||
syn match factorUse /\<USE:\s\+\S\+\>/
|
syn match factorUse /\<USE:\s\+\S\+\>/
|
||||||
syn match factorUnuse /\<UNUSE:\s\+\S\+\>/
|
syn match factorUnuse /\<UNUSE:\s\+\S\+\>/
|
||||||
|
|
||||||
syn match factorChar /\<CHAR:\s\+\S\+\>/
|
syn match factorChar /\<char:\s\+\S\+\>/
|
||||||
|
|
||||||
syn match factorBackslash /\<\\\>\s\+\S\+\>/
|
syn match factorBackslash /\<\\\>\s\+\S\+\>/
|
||||||
syn match factorMBackslash /\<M\\\>\s\+\S\+\s\+\S\+\>/
|
syn match factorMBackslash /\<M\\\>\s\+\S\+\s\+\S\+\>/
|
||||||
|
|
|
@ -18,9 +18,9 @@ short-url "SHORT_URLS" {
|
||||||
} define-persistent
|
} define-persistent
|
||||||
|
|
||||||
: letter-bank ( -- seq )
|
: letter-bank ( -- seq )
|
||||||
CHAR: a CHAR: z [a,b]
|
char: a char: z [a,b]
|
||||||
CHAR: A CHAR: Z [a,b]
|
char: A char: Z [a,b]
|
||||||
CHAR: 1 CHAR: 0 [a,b]
|
char: 1 char: 0 [a,b]
|
||||||
3append ; foldable
|
3append ; foldable
|
||||||
|
|
||||||
: random-url ( -- string )
|
: random-url ( -- string )
|
||||||
|
|
Loading…
Reference in New Issue