Skip to content
This repository has been archived by the owner on Mar 26, 2023. It is now read-only.

Issue 373 #391

Merged
merged 7 commits into from
May 1, 2015
Merged
Show file tree
Hide file tree
Changes from 4 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: 2 additions & 0 deletions default.mspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class MSpecScript
lang_files = ['spec/rubyspec/language',
"^spec/rubyspec/language/array_spec.rb",
"^spec/rubyspec/language/case_spec.rb",
"^spec/rubyspec/language/ensure_spec.rb",
"^spec/rubyspec/language/literal_lambda_spec.rb",
"^spec/rubyspec/language/for_spec.rb",
"^spec/rubyspec/language/block_spec.rb",
Expand Down Expand Up @@ -40,6 +41,7 @@ class MSpecScript
"^spec/rubyspec/core/symbol/encoding_spec.rb",
"^spec/rubyspec/core/symbol/length_spec.rb",
"^spec/rubyspec/core/symbol/size_spec.rb",
"^spec/rubyspec/core/thread/abort_on_exception_spec.rb",
"^spec/rubyspec/core/thread/wakeup_spec.rb"]

lib_files = ['spec/rubyspec/library',
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/bootstrap/Behavior.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
++++ obsolete file
# ++++ obsolete file
class Behavior

end
14 changes: 7 additions & 7 deletions src/kernel/bootstrap/FileStat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ def file?

def ftype
case @_st_mode & S_IFMT
when S_IFBLK : 'blockSpecial'
when S_IFCHR : 'characterSpecial'
when S_IFDIR : 'directory'
when S_IFIFO : 'fifo'
when S_IFLNK : 'link'
when S_IFREG : 'file'
when S_IFSOCK : 'socket'
when S_IFBLK then 'blockSpecial'
when S_IFCHR then 'characterSpecial'
when S_IFDIR then 'directory'
when S_IFIFO then 'fifo'
when S_IFLNK then 'link'
when S_IFREG then 'file'
when S_IFSOCK then 'socket'
else 'unknown'
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/bootstrap/Hash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def default_proc
end

def default_proc=(value)
raise (TypeError, "wrong default_proc type #{value.class} (expected Proc)") if !value.kind_of?(Proc) and !value.kind_of?(ExecBlock)
raise(TypeError, "wrong default_proc type #{value.class} (expected Proc)") if !value.kind_of?(Proc) and !value.kind_of?(ExecBlock)
@_st_defaultProc = value
@_st_default = nil
end
Expand Down
16 changes: 8 additions & 8 deletions src/kernel/common/ctype.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ def toprint
"\\#"
elsif isctrl
case self
when ?\n: "\\n"
when ?\t: "\\t"
when ?\a: "\\a"
when ?\v: "\\v"
when ?\f: "\\f"
when ?\r: "\\r"
when ?\e: "\\e"
when ?\b: "\\b"
when ?\n then "\\n"
when ?\t then "\\t"
when ?\a then "\\a"
when ?\v then "\\v"
when ?\f then "\\f"
when ?\r then "\\r"
when ?\e then "\\e"
when ?\b then "\\b"
end
elsif self < 32 || self > 126
str = "\\000"
Expand Down
17 changes: 7 additions & 10 deletions src/kernel/parser/grammar.y
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@

#include "rubygrammar.h"

#define IS_BEG() (lex_state == EXPR_BEG || lex_state == EXPR_MID || lex_state == EXPR_VALUE || lex_state == EXPR_CLASS)

#ifndef isnumber
#define isnumber isdigit
#endif
Expand Down Expand Up @@ -5677,19 +5679,14 @@ static int yylex(rb_parse_state* ps)
return '~';

case '(':
ps->command_start = TRUE;
if (IS_EXPR_BEG_or_MID(lex_state)) {
if (IS_BEG()) {
c = tLPAREN;
}
else if (space_seen) {
if (lex_state == EXPR_CMDARG) {
c = tLPAREN_ARG;
}
else if (lex_state == EXPR_ARG) {
rb_warning(ps, "don't put space before argument parentheses");
c = '(';
}
c = tLPAREN_ARG;
}

// TODO: paren_nest++;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the issues with this todo pending? Do you have any code that doesn't parse because of this in particular?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore me, Chrome didn't refresh the code for some reason..

COND_PUSH(ps, 0);
CMDARG_PUSH(ps, 0);
SET_lexState( EXPR_BEG);
Expand Down Expand Up @@ -6060,7 +6057,7 @@ static int yylex(rb_parse_state* ps)
if ((lex_state == EXPR_BEG && !cmd_state) || IS_ARG(lex_state)) {
int p_c = *(ps->lex_p); // actual peek
if (ch_equals(':', p_c) && !(ps->lex_p + 1 < ps->lex_pend && (ps->lex_p)[1] == ':')) {
lex_state = EXPR_BEG;
SET_lexState(EXPR_BEG);
nextc(ps);
NODE* symqO = rb_parser_sym( tok(ps) , ps);
*ps->lexvalH = RpNameToken::s( ps, symqO );
Expand Down
6 changes: 4 additions & 2 deletions src/kernel/parser/rubyparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ typedef enum {
EXPR_END = 2, /* newline significant, +/- is a operator. */
EXPR_ARG = 4, /* newline significant, +/- is a operator. */
EXPR_CMDARG = 8, /* newline significant, +/- is a operator. */
EXPR_ENDARG = 0x10, /* newline significant, +/- is a operator. */
EXPR_ENDARG = 0x10, /* newline significant, +/- is a operator, and unbound braces */
EXPR_MID = 0x20, /* newline significant, +/- is a operator. */
EXPR_FNAME = 0x40, /* ignore newline, no reserved words. */
EXPR_DOT = 0x80, /* right after `.' or `::', no reserved words. */
EXPR_CLASS = 0x100 /* immediate after `class', no here document. */
EXPR_CLASS = 0x100, /* immediate after `class', no here document. */
EXPR_VALUE = 0x200, /* like EXPR_BEG but label is disallowed */
EXPR_ENDFN = 0x400 /* newline significant, +/- is a operator, and unbound braces */
} LexStateKind;

class rb_parse_state ;
Expand Down
1 change: 1 addition & 0 deletions src/test/vmunit.conf
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ CaseTest.rb
# testEvalLineNumber.rb
testMassign.rb
# tests that require simple.rb
InvokeTest.rb
ArgsTest.rb
ArrayTest.rb
HashTest.rb
Expand Down
1 change: 0 additions & 1 deletion src/test/vmunit2.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# This is a list of tests that must be run through invoking
# $MAGLEV_HOME/bin/maglev-ruby (or, cannot be invoked from Smalltalk).

InvokeTest.rb
DigestTest.rb
Trac592.rb
Trac930.rb
Expand Down