Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avhtuple to android branch #663

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion boot.red
Expand Up @@ -49,6 +49,7 @@ bitset!: make datatype! #get-definition TYPE_BITSET
float!: make datatype! #get-definition TYPE_FLOAT
point!: make datatype! #get-definition TYPE_POINT
pair!: make datatype! #get-definition TYPE_PAIR
tuple!: make datatype! #get-definition TYPE_TUPLE

none: make none! 0
true: make logic! 1
Expand Down Expand Up @@ -929,6 +930,7 @@ refinement?: func ["Returns true if the value is this type." value [any-type!]]
set-path?: func ["Returns true if the value is this type." value [any-type!]] [set-path! = type? :value]
set-word?: func ["Returns true if the value is this type." value [any-type!]] [set-word! = type? :value]
string?: func ["Returns true if the value is this type." value [any-type!]] [string! = type? :value]
tuple?: func ["Returns true if the value is this type." value [any-type!]] [tuple! = type? :value]
unset?: func ["Returns true if the value is this type." value [any-type!]] [unset! = type? :value]
word?: func ["Returns true if the value is this type." value [any-type!]] [word! = type? :value]

Expand Down Expand Up @@ -1077,4 +1079,4 @@ parse-trace: func [
return: [logic! block!]
][
parse/trace input rules :on-parse-event
]
]
14 changes: 11 additions & 3 deletions lexer.r
Expand Up @@ -19,6 +19,7 @@ lexer: context [
e: none ;-- mark end position of new value
value: none ;-- new value
value2: none ;-- secondary new value
value3: none ;-- tertiary new value
fail?: none ;-- used for failing some parsing rules
type: none ;-- define the type of the new value

Expand Down Expand Up @@ -61,7 +62,7 @@ lexer: context [
not-mstr-char: #"}"
caret-char: charset [#"^(40)" - #"^(5F)"]
non-printable-char: charset [#"^(00)" - #"^(1F)"]
integer-end: charset {^{"]);x}
integer-end: charset {^{"]);x.}
stop: none

control-char: reduce [
Expand Down Expand Up @@ -216,8 +217,15 @@ lexer: context [
type: pair!
value2: to pair! reduce [value 0]
)
;Look at this
; #"." (
; type: tuple!
; value2: to tuple! reduce [value 0]
; value3: to tuple! reduce [value 0]
; )
s: integer-rule
(value2/2: load-integer copy/part s e value: value2)
; (value3/3: load-integer copy/part s e value: value3)
]
]

Expand Down Expand Up @@ -306,7 +314,7 @@ lexer: context [
| "set-word!" | "get-word!" | "lit-word!" | "refinement!"
| "binary!" | "string!" | "char!" | "bitset!" | "path!"
| "set-path!" | "lit-path!" | "native!" | "action!"
| "issue!" | "paren!" | "function!"
| "issue!" | "paren!" | "function!"|"pair!"|"tuple!"
] e: (value: get to word! copy/part s e)
] any-ws #"]"
]
Expand Down Expand Up @@ -528,4 +536,4 @@ lexer: context [
stack/reset
blk
]
]
]
4 changes: 3 additions & 1 deletion runtime/datatypes/common.reds
Expand Up @@ -128,6 +128,7 @@ words: context [
ahead: -1
x: -1
y: -1
z: -1

_body: as red-word! 0
_windows: as red-word! 0
Expand Down Expand Up @@ -197,6 +198,7 @@ words: context [

x: symbol/make "x"
y: symbol/make "y"
z: symbol/make "z"

_body: _context/add-global body
_windows: _context/add-global windows
Expand Down Expand Up @@ -224,4 +226,4 @@ refinements: context [
local: refinement/load "local"
extern: refinement/load "extern"
]
]
]
8 changes: 8 additions & 0 deletions runtime/datatypes/structures.reds
Expand Up @@ -184,6 +184,14 @@ red-pair!: alias struct! [
y [integer!] ;-- 32-bit signed integer or float32!
]

red-tuple!: alias struct! [
header [integer!] ;-- cell header
padding [integer!] ;-- align value on 64-bit boundary
x [integer!] ;-- 32-bit signed integer or float32!
y [integer!] ;-- 32-bit signed integer or float32!
z [integer!] ;-- 32-bit signed integer or float32!
]

red-action!: alias struct! [
header [integer!] ;-- cell header
symbols [node!] ;-- action cleaned-up spec block reference
Expand Down