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