factor: fix more syntax things

locals-and-roots
Doug Coleman 2016-06-22 16:04:49 -07:00
parent 60fde01039
commit e6aedf0d4c
11 changed files with 24 additions and 23 deletions

View File

@ -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 ? ] ;

View File

@ -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 ]
[

View File

@ -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

View File

@ -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 ;

View File

@ -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> ]]

View File

@ -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>

View File

@ -252,7 +252,7 @@
</dict>
<dict>
<key>match</key>
<string>(^|(?&lt;=\s))CHAR:\s+[^\s]+(\s|$)</string>
<string>(^|(?&lt;=\s))char:\s+[^\s]+(\s|$)</string>
<key>name</key>
<string>constant.character.factor</string>
</dict>

View File

@ -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"
}
{

View File

@ -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\+\>/

View File

@ -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\+\>/

View File

@ -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 )