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

GROUP! as new default term for PAREN! #206

Merged
merged 1 commit into from
Dec 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/boot/errors.r
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ Script: [
use-fail-for-error: [{Use FAIL (not THROW or DO) to raise} :arg1]
use-split-simple: {Use SPLIT (instead of PARSE) for "simple" parsing}

limited-fail-input: {FAIL requires complex expressions to be in a PAREN!}
limited-fail-input: {FAIL requires complex expressions to be in a GROUP!}

invalid-arg: [{invalid argument:} :arg1]
invalid-type: [:arg1 {type is not allowed here}]
Expand Down
4 changes: 2 additions & 2 deletions src/boot/strings.r
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ scan: ; Used by scanner. Keep in sync with Value_Types in scan.h file!
"end-of-script"
"newline"
"block-end"
"paren-end"
"group-end"
"word"
"word-set"
"word-get"
Expand All @@ -39,7 +39,7 @@ scan: ; Used by scanner. Keep in sync with Value_Types in scan.h file!
"date"
"char"
"block-begin"
"paren-begin"
"group-begin"
"string"
"binary"
"pair"
Expand Down
1 change: 1 addition & 0 deletions src/boot/sysobj.r
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ options: context [ ; Options supplied to REBOL during startup
break-with-overrides: false
none-instead-of-unsets: false
dont-exit-natives: false
paren-instead-of-group: false

; Legacy Options that *cannot* be enabled (due to mezzanine dependency
; on the new behavior). The points are retained in the code for purpose
Expand Down
2 changes: 1 addition & 1 deletion src/boot/types-ext.r
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ url * ser
tag * ser

block 33 ser
paren * ser
group * ser
path * ser
set-path * ser
get-path * ser
Expand Down
4 changes: 2 additions & 2 deletions src/boot/types.r
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ REBOL [
Note that if there is `somename` in the class column, that means you
will find the ACTION! dispatch for that type in `REBTYPE(Somename)`.

If the (CLASS) is in a paren that means it has evaluator behavior,
If the (CLASS) is in a GROUP! that means it has evaluator behavior,
vs. being passed through as-is. (e.g. a lit-word is "evaluative")
This is used to build the table used for fast lookup of whether the
evaluator needs to be called on a given type.
Expand Down Expand Up @@ -67,7 +67,7 @@ image image + + * * [series]
vector vector - - * * [series]

block array * f* * * [series array]
paren (array) * f* * * [series array]
group (array) * f* * * [series array]

path (array) * * * * [series path array]
set-path (array) * * * * [series path array]
Expand Down
4 changes: 2 additions & 2 deletions src/boot/typespec.r
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ REBOL [
action ["datatype native function (standard polymorphic)" function]
binary ["string series of bytes" string]
bitset ["set of bit flags" string]
block ["series of values" block]
block ["array of values that blocks evaluation unless DO is used" block]
char ["8bit and 16bit character" scalar]
closure ["function with persistent locals (indefinite extent)" function]
callback ["function to be called from C" scalar]
Expand Down Expand Up @@ -49,7 +49,7 @@ native ["direct CPU evaluated function" function]
none ["no value represented" scalar]
object ["context of names with values" context]
pair ["two dimensional point or size" scalar]
paren ["automatically evaluating block" block]
group ["array that evaluates expressions as an isolated group" block]
path ["refinements to functions, objects, files" block]
percent ["special form of decimals (used mainly for layout)" scalar]
port ["external series, an I/O channel" context]
Expand Down
10 changes: 10 additions & 0 deletions src/boot/words.r
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ datatypes
; this list is applied, so you only see typesets in this file.
;-----------------------------------------------------------------------------

; For the moment, TO-WORD of a datatype is willing to canonize a datatype
; as a word. Long term, that specialization is not desirable because it
; is effectively building keywords deep into the system. Better would be
; if datatypes could be communicated e.g. by #[()] for "groups" or "parens".
;
; Hardcoding in the GROUP! symbol is necessary for a legacy switch to be
; willing to convert a "group!" into the word GROUP!
;
paren!

native
action
self
Expand Down
2 changes: 1 addition & 1 deletion src/core/a-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ RL_API REBEVT *RL_Find_Event (REBINT model, REBINT type)
//
// Allocate a series suitable for storing Rebol values. This series
// can be used as a backing store for a BLOCK!, but also for any
// other Rebol Array type (PAREN!, PATH!, GET-PATH!, SET-PATH!, or
// other Rebol Array type (GROUP!, PATH!, GET-PATH!, SET-PATH!, or
// LIT-PATH!).
//
// Returns:
Expand Down
33 changes: 16 additions & 17 deletions src/core/c-do.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ REBOOL Next_Path_Throws(REBPVS *pvs)
fail (Error(RE_NO_VALUE, path));
}
// object/(expr) case:
else if (IS_PAREN(path)) {
else if (IS_GROUP(path)) {
if (DO_ARRAY_THROWS(&temp, path)) {
*pvs->value = temp;
return TRUE;
Expand Down Expand Up @@ -497,7 +497,7 @@ REBOOL Do_Path_Throws(REBVAL *out, REBCNT *label_sym, const REBVAL *path, REBVAL
for (; NOT_END(pvs.path); pvs.path++) { // "the refinements"
if (IS_NONE(pvs.path)) continue;

if (IS_PAREN(pvs.path)) {
if (IS_GROUP(pvs.path)) {
// Note it is not legal to use the data stack directly as the
// output location for a DO (might be resized)

Expand Down Expand Up @@ -571,7 +571,7 @@ REBOOL Do_Path_Throws(REBVAL *out, REBCNT *label_sym, const REBVAL *path, REBVAL
// Pick_Path: C
//
// Lightweight version of Do_Path used for A_PICK actions.
// Does not do paren evaluation, hence not designed to throw.
// Does not do GROUP! evaluation, hence not designed to throw.
//
void Pick_Path(REBVAL *out, REBVAL *value, REBVAL *selector, REBVAL *val)
{
Expand Down Expand Up @@ -1053,7 +1053,7 @@ void Do_Core(struct Reb_Call * const c)
//
if (C_STACK_OVERFLOWING(&c)) Trap_Stack_Overflow();

// Mark this Reb_Call state as "inert" (e.g. no function or paren eval
// Mark this Reb_Call state as "inert" (e.g. no FUNCTION! or GROUP! eval
// in progress that the GC need worry about) and push it to the Do Stack.
// If the state transitions to something the GC should start protecting
// fields of the Reb_Call for, it will.
Expand Down Expand Up @@ -1355,7 +1355,7 @@ void Do_Core(struct Reb_Call * const c)
// item being GC'd, it should be taken care of by the implicit
// protection from the Do Stack. (e.g. if it contains a function
// that gets evaluated it will wind up in c->func, if it's a
// paren or path-containing-paren it winds up in c->array...)
// GROUP! or PATH!-containing-GROUP! it winds up in c->array...)
//
c->value = &eval;
c->index--;
Expand Down Expand Up @@ -1829,7 +1829,7 @@ void Do_Core(struct Reb_Call * const c)
if (
VAL_GET_EXT(c->param, EXT_TYPESET_EVALUATE)
&& (
IS_PAREN(c->value)
IS_GROUP(c->value)
|| IS_GET_WORD(c->value)
|| IS_GET_PATH(c->value)
)
Expand Down Expand Up @@ -1994,8 +1994,8 @@ void Do_Core(struct Reb_Call * const c)
//
// append/(second [only asdhjas])/(print "hi") [a b c] [d]
//
// ...it would never make it to the print. Here we do all the path
// and paren evals up front and check that things are words or NONE,
// ...it would never make it to the print. Here we do all the PATH!
// and GROUP! evals up front and check that things are words or NONE,
// not knowing if a refinement isn't on the function until the end.
//
if (c->mode == CALL_MODE_SCANNING)
Expand Down Expand Up @@ -2187,9 +2187,9 @@ void Do_Core(struct Reb_Call * const c)
assert(DSP == c->dsp_orig);
break;

// [PAREN!]
// [GROUP!]
//
case REB_PAREN:
case REB_GROUP:
if (DO_ARRAY_THROWS(c->out, c->value))
goto return_thrown;

Expand Down Expand Up @@ -2557,10 +2557,9 @@ REBOOL Reduce_Array_No_Set_Throws(
//
// Compose_Values_Throws: C
//
// Compose a block from a block of un-evaluated values and
// paren blocks that are evaluated. Performs evaluations, so
// if 'into' is provided, then its series must be protected from
// garbage collection.
// Compose a block from a block of un-evaluated values and GROUP! arrays that
// are evaluated. This calls into Do_Core, so if 'into' is provided, then its
// series must be protected from garbage collection.
//
// deep - recurse into sub-blocks
// only - parens that return blocks are kept as blocks
Expand All @@ -2577,7 +2576,7 @@ REBOOL Compose_Values_Throws(
REBINT dsp_orig = DSP;

for (; NOT_END(value); value++) {
if (IS_PAREN(value)) {
if (IS_GROUP(value)) {
REBVAL evaluated;
VAL_INIT_WRITABLE_DEBUG(&evaluated);

Expand Down Expand Up @@ -2633,7 +2632,7 @@ REBOOL Compose_Values_Throws(
if (ANY_ARRAY(value)) {
//
// compose [copy/(orig) (copy)] => [copy/(orig) (copy)]
// !!! path and second paren are copies, first paren isn't
// !!! path and second group are copies, first group isn't
//
VAL_ARRAY(DS_TOP) = Copy_Array_Shallow(VAL_ARRAY(value));
MANAGE_ARRAY(VAL_ARRAY(DS_TOP));
Expand Down Expand Up @@ -2754,7 +2753,7 @@ REBOOL Apply_Func_Throws_Core(
c->label_sym = label_sym;
c->out = out;

// Mark this Reb_Call state as "inert" (e.g. no function or paren eval
// Mark this Reb_Call state as "inert" (e.g. no FUNCTION! or GROUP! eval
// in progress that the GC need worry about) and push it to the Do Stack.
// If the state transitions to something the GC should start protecting
// fields of the Reb_Call for, it will.
Expand Down
2 changes: 1 addition & 1 deletion src/core/c-error.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ REBCNT Stack_Depth(void)
while (call) {
if (call->mode == CALL_MODE_FUNCTION) {
//
// We only count invoked functions (not paren or path evaluations
// We only count invoked functions (not group or path evaluations
// or "pending" functions that are building their arguments but
// have not been formally invoked yet)
//
Expand Down
2 changes: 1 addition & 1 deletion src/core/c-frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -1748,7 +1748,7 @@ REBVAL *Get_Var_Core(const REBVAL *any_word, REBOOL trap, REBOOL writable)
//
// Currently the only `mode` in which a frame should be
// considered as a legitimate match is CALL_MODE_FUNCTION.
// Other call types include a paren being recursed or
// Other call types include a GROUP! being recursed or
// a function whose frame is pending and doesn't have all
// the arguments ready yet... these shouldn't count.
//
Expand Down
4 changes: 2 additions & 2 deletions src/core/c-function.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ REBARR *Make_Paramlist_Managed(REBARR *spec)

case REB_LIT_WORD:
VAL_SET_EXT(typeset, EXT_TYPESET_QUOTE);
// will actually only evaluate get-word!, get-path!, and paren!
// will actually only evaluate get-word!, get-path!, and group!
VAL_SET_EXT(typeset, EXT_TYPESET_EVALUATE);
break;

Expand Down Expand Up @@ -403,7 +403,7 @@ REBARR *Get_Maybe_Fake_Func_Body(REBOOL *is_fake, const REBVAL *func)

// Index 5 (or 4 in zero-based C) should be #BODY, a "real" body
assert(IS_ISSUE(ARRAY_AT(fake_body, 4))); // #BODY
Val_Init_Array(ARRAY_AT(fake_body, 4), REB_PAREN, VAL_FUNC_BODY(func));
Val_Init_Array(ARRAY_AT(fake_body, 4), REB_GROUP, VAL_FUNC_BODY(func));
VAL_SET_OPT(ARRAY_AT(fake_body, 4), OPT_VALUE_LINE);

return fake_body;
Expand Down
4 changes: 2 additions & 2 deletions src/core/f-extension.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,9 +683,9 @@ void Do_Commands(REBVAL *out, REBARR *cmds, void *context)
val = &save;
}
}
else if (IS_PAREN(val)) {
else if (IS_GROUP(val)) {
if (DO_ARRAY_THROWS(&save, val)) {
// !!! Should this paren evaluation be able to "bubble
// !!! Should this GROUP! evaluation be able to "bubble
// up" so that returns and throws can be caught up
// the stack, or is raising an error here sufficient?

Expand Down
2 changes: 1 addition & 1 deletion src/core/f-series.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ REBINT Cmp_Value(const REBVAL *s, const REBVAL *t, REBOOL is_case)
return Cmp_Date(s, t);

case REB_BLOCK:
case REB_PAREN:
case REB_GROUP:
case REB_MAP:
case REB_PATH:
case REB_SET_PATH:
Expand Down
8 changes: 4 additions & 4 deletions src/core/l-scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,8 +734,8 @@ static REBCNT Prescan_Token(SCAN_STATE *scan_state)
// TOKEN_ in the scanner state. The TOKEN_ type returned will
// correspond directly to a Rebol datatype if it isn't an
// ANY-ARRAY! (e.g. TOKEN_INTEGER for INTEGER! or TOKEN_STRING
// for STRING!). When a block or paren delimiter was found it
// will indicate that (e.g. TOKEN_BLOCK_BEGIN or TOKEN_PAREN_END).
// for STRING!). When a block or group delimiter was found it
// will indicate that (e.g. TOKEN_BLOCK_BEGIN or TOKEN_GROUP_END).
// Hence the routine will have to be called multiple times during
// the array's content scan.
//
Expand Down Expand Up @@ -1324,7 +1324,7 @@ static REBARR *Scan_Full_Block(SCAN_STATE *scan_state, REBYTE mode_char);
//
// Scan_Block: C
//
// Scan a block (or paren) and return it.
// Scan a block (or group) and return it.
// Sub scanners may return bad by setting value type to zero.
//
static REBARR *Scan_Block(SCAN_STATE *scan_state, REBYTE mode_char)
Expand Down Expand Up @@ -1499,7 +1499,7 @@ static REBARR *Scan_Block(SCAN_STATE *scan_state, REBYTE mode_char)
}
Val_Init_Array(
value,
(token == TOKEN_BLOCK_BEGIN) ? REB_BLOCK : REB_PAREN,
(token == TOKEN_BLOCK_BEGIN) ? REB_BLOCK : REB_GROUP,
block
);
break;
Expand Down
4 changes: 2 additions & 2 deletions src/core/m-gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ static void Mark_Call_Frames_Deep(void)
// The only field we protect if no function is pending or running
// with this frame is the array itself. This is important if we
// do something like `eval copy quote (recycle)`, because while
// evaluating the paren it has no anchor anywhere in the root set
// evaluating the group it has no anchor anywhere in the root set
// and could be GC'd. The Reb_Call's array ref is all we have.
//
continue;
Expand Down Expand Up @@ -797,7 +797,7 @@ void Queue_Mark_Value_Deep(const REBVAL *val)
break;

case REB_BLOCK:
case REB_PAREN:
case REB_GROUP:
case REB_PATH:
case REB_SET_PATH:
case REB_GET_PATH:
Expand Down
18 changes: 9 additions & 9 deletions src/core/n-control.c
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ REBNATIVE(continue)
//
// {Evaluates a block of source code (directly or fetched according to type)}
//
// source [unset! none! block! paren! string! binary! url! file! tag!
// source [unset! none! block! group! string! binary! url! file! tag!
// error! any-function!]
// /args {If value is a script, this will set its system/script/args}
// arg "Args passed to a script (normally a string)"
Expand All @@ -941,7 +941,7 @@ REBNATIVE(do)
return R_NONE;

case REB_BLOCK:
case REB_PAREN:
case REB_GROUP:
if (REF(next)) {
DO_NEXT_MAY_THROW(
VAL_INDEX(ARG(value)), // updates index of value in call frame
Expand Down Expand Up @@ -1196,9 +1196,9 @@ REBNATIVE(fail)
if (IS_STRING(item) || IS_SCALAR(item))
continue;

// Leave the paren in and let the reduce take care of it
// Leave the group in and let the reduce take care of it
//
if (IS_PAREN(item))
if (IS_GROUP(item))
continue;

// Leave words in to be handled by the reduce step as long
Expand All @@ -1216,14 +1216,14 @@ REBNATIVE(fail)

// The only way to tell if a path resolves to a function
// or not is to actually evaluate it, and we are delegating
// to Reduce_Block ATM. For now we force you to use a PAREN!
// to Reduce_Block ATM. For now we force you to use a GROUP!
//
// fail [{Erroring on} (the/safe/side) {for now.}]
//
fail (Error(RE_LIMITED_FAIL_INPUT));
}

// We just reduce and form the result, but since we allow PAREN!
// We just reduce and form the result, but since we allow GROUP!
// it means you can put in pretty much any expression.
//
if (Reduce_Array_Throws(
Expand Down Expand Up @@ -1653,12 +1653,12 @@ REBNATIVE(switch)
continue;
}

// GET-WORD!, GET-PATH!, and PAREN! are evaluated (an escaping
// GET-WORD!, GET-PATH!, and GROUP! are evaluated (an escaping
// mechanism as in lit-quotes of function specs to avoid quoting)
// You can still evaluate to one of these, e.g. `(quote :foo)` to
// use parens to produce a GET-WORD! to test against.

if (IS_PAREN(item)) {
if (IS_GROUP(item)) {

#if !defined(NDEBUG)
if (LEGACY(OPTIONS_NO_SWITCH_EVALS)) {
Expand Down Expand Up @@ -1747,7 +1747,7 @@ REBNATIVE(switch)
// let cases that do not have a block after them be evaluated
// (if necessary) and the last one to fall through and be the
// result. This offers a nicer syntax for a default, especially
// when PAREN! is taken into account.
// when GROUP! is taken into account.
//
// However, running in legacy compatibility mode we need to squash
// the value into a NONE! so it doesn't fall through.
Expand Down
Loading