From 72de75b881c8854f92bae57fa66606e63de9a0b6 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Wed, 23 Nov 2011 19:22:37 -0800 Subject: [PATCH] let's pretend BIN: HEX: OCT: never happened --- basis/io/files/info/unix/unix-docs.factor | 4 +- basis/xmode/modes/factor.xml | 9 ----- core/parser/parser-docs.factor | 4 +- core/parser/parser-tests.factor | 5 --- core/syntax/syntax-docs.factor | 38 +++++-------------- .../Syntaxes/Factor.tmLanguage | 12 ------ misc/fuel/fuel-syntax.el | 10 ++--- misc/vim/syntax/factor.vim | 12 +++--- 8 files changed, 23 insertions(+), 71 deletions(-) diff --git a/basis/io/files/info/unix/unix-docs.factor b/basis/io/files/info/unix/unix-docs.factor index 82d1e727f9..425f76b18d 100644 --- a/basis/io/files/info/unix/unix-docs.factor +++ b/basis/io/files/info/unix/unix-docs.factor @@ -100,8 +100,8 @@ HELP: set-file-ids HELP: set-file-permissions { $values { "path" "a pathname string" } { "n" "an integer, interepreted as a string of bits" } } -{ $description "Sets the file permissions for a given file with the supplied Unix permissions integer. Supplying an octal number with " { $link POSTPONE: OCT: } " is recommended." } -{ $examples "Using the tradidional octal value:" +{ $description "Sets the file permissions for a given file with the supplied Unix permissions integer." } +{ $examples "Using the traditional octal value:" { $code "USING: io.files.info.unix kernel ;" "\"resource:license.txt\" 0o755 set-file-permissions" } diff --git a/basis/xmode/modes/factor.xml b/basis/xmode/modes/factor.xml index 9aa545eaec..4b4abfdb43 100644 --- a/basis/xmode/modes/factor.xml +++ b/basis/xmode/modes/factor.xml @@ -36,15 +36,6 @@ CHAR:\s+(\S+) - BIN:\s+(\S+) - OCT:\s+(\S+) - HEX:\s+(\S+) ( diff --git a/core/parser/parser-docs.factor b/core/parser/parser-docs.factor index 9aed5b5004..84f8b6dee4 100644 --- a/core/parser/parser-docs.factor +++ b/core/parser/parser-docs.factor @@ -21,11 +21,9 @@ ARTICLE: "reading-ahead" "Reading ahead" (scan-token) (scan-datum) } -"For example, the " { $link POSTPONE: HEX: } " word uses this feature to read hexadecimal literals:" -{ $see POSTPONE: HEX: } "It is defined in terms of a lower-level word that takes the numerical base on the data stack, but reads the number from the parser and then adds it to the parse tree:" { $see parse-base } -"Another simple example is the " { $link POSTPONE: \ } " word:" +"A simple example is the " { $link POSTPONE: \ } " word:" { $see POSTPONE: \ } ; ARTICLE: "parsing-word-nest" "Nested structure" diff --git a/core/parser/parser-tests.factor b/core/parser/parser-tests.factor index 560930c5ec..57f060e937 100644 --- a/core/parser/parser-tests.factor +++ b/core/parser/parser-tests.factor @@ -81,11 +81,6 @@ unit-test ! Funny bug [ 2 ] [ "IN: parser.tests : \0. ( -- x ) 2 ; \0." eval( -- n ) ] unit-test -! These should throw errors -[ "HEX: zzz" eval( -- obj ) ] must-fail -[ "OCT: 999" eval( -- obj ) ] must-fail -[ "BIN: --0" eval( -- obj ) ] must-fail - DEFER: foo "IN: parser.tests USING: math prettyprint ; SYNTAX: foo 2 2 + . ;" eval( -- ) diff --git a/core/syntax/syntax-docs.factor b/core/syntax/syntax-docs.factor index 5a3e237ab3..81d24079b0 100644 --- a/core/syntax/syntax-docs.factor +++ b/core/syntax/syntax-docs.factor @@ -45,11 +45,14 @@ ARTICLE: "syntax-integers" "Integer syntax" "-10" "2432902008176640000" } -"Integers are entered in base 10 unless prefixed with a base change parsing word." -{ $subsections - POSTPONE: BIN: - POSTPONE: OCT: - POSTPONE: HEX: +"Integers are entered in base 10 unless prefixed with a base-changing prefix. " { $snippet "0x" } " begins a hexadecimal literal, " { $snippet "0o" } " an octal literal, and " { $snippet "0b" } " a binary literal. A sign, if any, goes before the base prefix." +{ $example + "USE: prettyprint" + "10 ." + "0b10 ." + "-0o10 ." + "0x10 ." + "10\n2\n-8\n16" } "More information on integers can be found in " { $link "integers" } "." ; @@ -109,14 +112,14 @@ ARTICLE: "syntax-floats" "Float syntax" "t" } { $example - "1024.0 0x1.0P10 = ." + "-1024.0 -0x1.0P10 = ." "t" } { $example "10.125 0x1.44p3 = ." "t" } -"The normalized hex form " { $snippet "HEX: ±1.MMMMMMMMMMMMMp±EEEE" } " allows any floating-point number to be specified precisely. The values of MMMMMMMMMMMMM and EEEE map directly to the mantissa and exponent fields of IEEE 754 representation." +"The normalized hex form " { $snippet "±0x1.MMMMMMMMMMMMMp±EEEE" } " allows any floating-point number to be specified precisely. The values of MMMMMMMMMMMMM and EEEE map directly to the mantissa and exponent fields of the binary IEEE 754 representation." $nl "More information on floats can be found in " { $link "floats" } "." ; @@ -658,27 +661,6 @@ HELP: #! { $values { "comment" "characters" } } { $description "Discards all input until the end of the line." } ; -HELP: HEX: -{ $syntax "HEX: NNN" "HEX: NNN.NNNpEEE" } -{ $values { "N" "hexadecimal digit (0-9, a-f, A-F)" } { "pEEE" "decimal exponent value" } } -{ $description "Adds an integer or floating-point value read from a hexadecimal literal to the parse tree." } -{ $examples - { $example "USE: prettyprint" "0xff ." "255" } - { $example "USE: prettyprint" "0x1.8p5 ." "48.0" } -} ; - -HELP: OCT: -{ $syntax "OCT: integer" } -{ $values { "integer" "octal digits (0-7)" } } -{ $description "Adds an integer read from an octal literal to the parse tree." } -{ $examples { $example "USE: prettyprint" "0o31337 ." "13023" } } ; - -HELP: BIN: -{ $syntax "BIN: integer" } -{ $values { "integer" "binary digits (0 and 1)" } } -{ $description "Adds an integer read from an binary literal to the parse tree." } -{ $examples { $example "USE: prettyprint" "0b100 ." "4" } } ; - HELP: NAN: { $syntax "NAN: payload" } { $values { "payload" "64-bit hexadecimal integer" } } diff --git a/misc/Factor.tmbundle/Syntaxes/Factor.tmLanguage b/misc/Factor.tmbundle/Syntaxes/Factor.tmLanguage index 199185c93d..d71e5a8f35 100644 --- a/misc/Factor.tmbundle/Syntaxes/Factor.tmLanguage +++ b/misc/Factor.tmbundle/Syntaxes/Factor.tmLanguage @@ -201,18 +201,6 @@ name constant.character.factor - - match - (^|(?<=\s))((BIN:|OCT:)\s+)?-?\d+(\s|$) - name - constant.numeric.integer.factor - - - match - (^|(?<=\s))HEX:\s+-?[\dA-Fa-f]+(\s|$) - name - constant.numeric.hexadecimal.integer.factor - match (^|(?<=\s))-?+\d+\.\d+(E(\+|-)\d+)?(\s|$) diff --git a/misc/fuel/fuel-syntax.el b/misc/fuel/fuel-syntax.el index e2db30db3d..e7d4f0ef17 100644 --- a/misc/fuel/fuel-syntax.el +++ b/misc/fuel/fuel-syntax.el @@ -46,20 +46,19 @@ (defconst fuel-syntax--parsing-words '(":" "::" ";" "&:" "<<" ">" "ABOUT:" "AFTER:" "ALIAS:" "ALIEN:" "ARTICLE:" - "B" "BEFORE:" "BIN:" + "B" "BEFORE:" "C:" "CALLBACK:" "C-GLOBAL:" "C-TYPE:" "CHAR:" "COM-INTERFACE:" "CONSTANT:" "CONSULT:" "call-next-method" "DEFER:" "DESTRUCTOR:" "EBNF:" ";EBNF" "ENUM:" "ERROR:" "EXCLUDE:" "f" "FORGET:" "FROM:" "FUNCTION:" "FUNCTION-ALIAS:" "GAME:" "GENERIC#" "GENERIC:" "GLSL-SHADER:" "GLSL-PROGRAM:" - "HELP:" "HEX:" "HOOK:" + "HELP:" "HOOK:" "IN:" "initial:" "INSTANCE:" "INTERSECTION:" "LIBRARY:" "M:" "M::" "MACRO:" "MACRO::" "MAIN:" "MATH:" "MEMO:" "MEMO:" "METHOD:" "MIXIN:" "NAN:" - "OCT:" "POSTPONE:" "PREDICATE:" "PRIMITIVE:" "PRIVATE>" "PROTOCOL:" "PROVIDE:" "QUALIFIED-WITH:" "QUALIFIED:" "read-only" "RENAME:" "REQUIRE:" "REQUIRES:" @@ -129,7 +128,7 @@ '("IN:" "USE:" "FROM:" "EXCLUDE:" "QUALIFIED:" "QUALIFIED-WITH:"))) (defconst fuel-syntax--int-constant-def-regex - (fuel-syntax--second-word-regex '("ALIEN:" "CHAR:" "BIN:" "HEX:" "NAN:" "OCT:"))) + (fuel-syntax--second-word-regex '("ALIEN:" "CHAR:" "NAN:"))) (defconst fuel-syntax--type-definition-regex (fuel-syntax--second-word-regex @@ -208,12 +207,11 @@ "DEFER:" "DESTRUCTOR:" "FORGET:" "GAME:" "GENERIC:" "GENERIC#" "GLSL-PROGRAM:" - "HEX:" "HOOK:" + "HOOK:" "IN:" "INSTANCE:" "LIBRARY:" "MAIN:" "MATH:" "MIXIN:" "NAN:" - "OCT:" "POSTPONE:" "PRIVATE>" "/ syn match factorNegRatio /\<\-[0-9]\([0-9,]*[0-9]\)\?\(\-[0-9]\([0-9,]*[0-9]\+\)\?\)\?\/-\=[0-9]\([0-9,]*[0-9]\+\)\?\.\?\>/ syn region factorComplex start=/\/ end=/\<}\>/ contains=@factorReal -syn match factorBinErr /\/ -syn match factorBinary /\/ -syn match factorHexErr /\/ -syn match factorHex /\/ -syn match factorOctErr /\/ -syn match factorOctal /\/ +syn match factorBinErr /\<-\=0b[01,]*[^01 ]\S*\>/ +syn match factorBinary /\<-\=0b[01,]\+\>/ +syn match factorHexErr /\<-\=0x\(,\S*\|\S*,\|[-0-9a-fA-Fp,]*[^-0-9a-fA-Fp, ]\S*\)\>/ +syn match factorHex /\<-\=0x[0-9a-fA-F]\([0-9a-fA-F,]*[0-9a-fA-F]\)\?\(\.[0-9a-fA-F]\([0-9a-fA-F,]*[0-9a-fA-F]\)\?\)\?\(p-\=[0-9]\([0-9,]*[0-9]\)\?\)\?\>/ +syn match factorOctErr /\<-\=0o\(,\S*\|\S*,\|[0-7,]*[^0-7, ]\S*\)\>/ +syn match factorOctal /\<\+-\=0o[0-7,]\+\>/ syn match factorNan /\/ syn match factorIn /\/