Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
e31c7eec
Commit
e31c7eec
authored
Apr 09, 1993
by
Tom Wood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
From-SVN: r4068
parent
8b40563c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
367 additions
and
190 deletions
+367
-190
gcc/c-lex.c
+208
-120
gcc/c-parse.in
+159
-70
gcc/objc/objc-act.c
+0
-0
No files found.
gcc/c-lex.c
View file @
e31c7eec
...
@@ -58,7 +58,7 @@ tree lastiddecl;
...
@@ -58,7 +58,7 @@ tree lastiddecl;
int
doing_objc_thang
;
int
doing_objc_thang
;
extern
tree
lookup_interfac
e
();
extern
tree
is_class_nam
e
();
extern
int
yydebug
;
extern
int
yydebug
;
...
@@ -93,15 +93,15 @@ int check_newline ();
...
@@ -93,15 +93,15 @@ int check_newline ();
static
int
ignore_escape_flag
=
0
;
static
int
ignore_escape_flag
=
0
;
/* C code produced by gperf version 2.5 (GNU C++ version) */
/* C code produced by gperf version 2.5 (GNU C++ version) */
/* Command-line: gperf -p -j1 -i 1 -g -o -t -
N is_reserved_word -k1,3,$ c-parse.gperf */
/* Command-line: gperf -p -j1 -i 1 -g -o -t -
G -N is_reserved_word -k1,3,$ c-parse.gperf */
struct
resword
{
char
*
name
;
short
token
;
enum
rid
rid
;
};
struct
resword
{
char
*
name
;
short
token
;
enum
rid
rid
;
};
#define TOTAL_KEYWORDS
61
#define TOTAL_KEYWORDS
79
#define MIN_WORD_LENGTH 2
#define MIN_WORD_LENGTH 2
#define MAX_WORD_LENGTH
13
#define MAX_WORD_LENGTH
20
#define MIN_HASH_VALUE 10
#define MIN_HASH_VALUE 10
#define MAX_HASH_VALUE
95
#define MAX_HASH_VALUE
144
/* maximum key range =
86
, duplicates = 0 */
/* maximum key range =
135
, duplicates = 0 */
#ifdef __GNUC__
#ifdef __GNUC__
__inline
__inline
...
@@ -113,19 +113,19 @@ hash (str, len)
...
@@ -113,19 +113,19 @@ hash (str, len)
{
{
static
unsigned
char
asso_values
[]
=
static
unsigned
char
asso_values
[]
=
{
{
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
145
,
145
,
145
,
145
,
25
,
145
,
145
,
145
,
145
,
145
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
96
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
145
,
96
,
96
,
96
,
96
,
96
,
1
,
96
,
15
,
13
,
23
,
145
,
145
,
145
,
145
,
145
,
1
,
145
,
46
,
8
,
15
,
1
,
6
,
32
,
36
,
3
,
5
,
96
,
1
,
20
,
29
,
61
,
6
,
36
,
48
,
3
,
5
,
145
,
18
,
63
,
25
,
31
,
44
,
19
,
96
,
13
,
2
,
1
,
54
,
39
,
11
,
29
,
76
,
1
,
145
,
13
,
2
,
1
,
51
,
37
,
9
,
5
,
96
,
3
,
96
,
96
,
96
,
96
,
96
,
9
,
1
,
3
,
145
,
145
,
145
,
145
,
145
,
};
};
register
int
hval
=
len
;
register
int
hval
=
len
;
...
@@ -141,6 +141,119 @@ hash (str, len)
...
@@ -141,6 +141,119 @@ hash (str, len)
return
hval
+
asso_values
[
str
[
len
-
1
]];
return
hval
+
asso_values
[
str
[
len
-
1
]];
}
}
static
struct
resword
wordlist
[]
=
{
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
"int"
,
TYPESPEC
,
RID_INT
},
{
""
,},
{
""
,},
{
"__typeof__"
,
TYPEOF
,
NORID
},
{
"__signed__"
,
TYPESPEC
,
RID_SIGNED
},
{
"__imag__"
,
IMAGPART
,
NORID
},
{
"switch"
,
SWITCH
,
NORID
},
{
"__inline__"
,
SCSPEC
,
RID_INLINE
},
{
"else"
,
ELSE
,
NORID
},
{
"__iterator__"
,
SCSPEC
,
RID_ITERATOR
},
{
"__inline"
,
SCSPEC
,
RID_INLINE
},
{
"__extension__"
,
EXTENSION
,
NORID
},
{
"struct"
,
STRUCT
,
NORID
},
{
"__real__"
,
REALPART
,
NORID
},
{
"__const"
,
TYPE_QUAL
,
RID_CONST
},
{
"while"
,
WHILE
,
NORID
},
{
"__const__"
,
TYPE_QUAL
,
RID_CONST
},
{
"case"
,
CASE
,
NORID
},
{
"__complex__"
,
TYPESPEC
,
RID_COMPLEX
},
{
"__iterator"
,
SCSPEC
,
RID_ITERATOR
},
{
"bycopy"
,
TYPE_QUAL
,
RID_BYCOPY
},
{
""
,},
{
""
,},
{
""
,},
{
"__complex"
,
TYPESPEC
,
RID_COMPLEX
},
{
""
,},
{
"in"
,
TYPE_QUAL
,
RID_IN
},
{
"break"
,
BREAK
,
NORID
},
{
"@defs"
,
DEFS
,
NORID
},
{
""
,},
{
""
,},
{
""
,},
{
"extern"
,
SCSPEC
,
RID_EXTERN
},
{
"if"
,
IF
,
NORID
},
{
"typeof"
,
TYPEOF
,
NORID
},
{
"typedef"
,
SCSPEC
,
RID_TYPEDEF
},
{
"__typeof"
,
TYPEOF
,
NORID
},
{
"sizeof"
,
SIZEOF
,
NORID
},
{
""
,},
{
"return"
,
RETURN
,
NORID
},
{
"const"
,
TYPE_QUAL
,
RID_CONST
},
{
"__volatile__"
,
TYPE_QUAL
,
RID_VOLATILE
},
{
"@private"
,
PRIVATE
,
NORID
},
{
"@selector"
,
SELECTOR
,
NORID
},
{
"__volatile"
,
TYPE_QUAL
,
RID_VOLATILE
},
{
"__asm__"
,
ASM_KEYWORD
,
NORID
},
{
""
,},
{
""
,},
{
"continue"
,
CONTINUE
,
NORID
},
{
"__alignof__"
,
ALIGNOF
,
NORID
},
{
"__imag"
,
IMAGPART
,
NORID
},
{
"__attribute__"
,
ATTRIBUTE
,
NORID
},
{
""
,},
{
""
,},
{
"__attribute"
,
ATTRIBUTE
,
NORID
},
{
"for"
,
FOR
,
NORID
},
{
""
,},
{
"@encode"
,
ENCODE
,
NORID
},
{
"id"
,
OBJECTNAME
,
RID_ID
},
{
"static"
,
SCSPEC
,
RID_STATIC
},
{
"@interface"
,
INTERFACE
,
NORID
},
{
""
,},
{
"__signed"
,
TYPESPEC
,
RID_SIGNED
},
{
""
,},
{
"__label__"
,
LABEL
,
NORID
},
{
""
,},
{
""
,},
{
"__asm"
,
ASM_KEYWORD
,
NORID
},
{
"char"
,
TYPESPEC
,
RID_CHAR
},
{
""
,},
{
"inline"
,
SCSPEC
,
RID_INLINE
},
{
"out"
,
TYPE_QUAL
,
RID_OUT
},
{
"register"
,
SCSPEC
,
RID_REGISTER
},
{
"__real"
,
REALPART
,
NORID
},
{
"short"
,
TYPESPEC
,
RID_SHORT
},
{
""
,},
{
"enum"
,
ENUM
,
NORID
},
{
"inout"
,
TYPE_QUAL
,
RID_INOUT
},
{
""
,},
{
"oneway"
,
TYPE_QUAL
,
RID_ONEWAY
},
{
"union"
,
UNION
,
NORID
},
{
""
,},
{
"__alignof"
,
ALIGNOF
,
NORID
},
{
""
,},
{
"@implementation"
,
IMPLEMENTATION
,
NORID
},
{
""
,},
{
"@class"
,
CLASS
,
NORID
},
{
""
,},
{
"@public"
,
PUBLIC
,
NORID
},
{
"asm"
,
ASM_KEYWORD
,
NORID
},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
"default"
,
DEFAULT
,
NORID
},
{
""
,},
{
"void"
,
TYPESPEC
,
RID_VOID
},
{
""
,},
{
"@protected"
,
PROTECTED
,
NORID
},
{
"@protocol"
,
PROTOCOL
,
NORID
},
{
""
,},
{
""
,},
{
""
,},
{
"volatile"
,
TYPE_QUAL
,
RID_VOLATILE
},
{
""
,},
{
""
,},
{
"signed"
,
TYPESPEC
,
RID_SIGNED
},
{
"float"
,
TYPESPEC
,
RID_FLOAT
},
{
"@end"
,
END
,
NORID
},
{
""
,},
{
""
,},
{
"unsigned"
,
TYPESPEC
,
RID_UNSIGNED
},
{
"@compatibility_alias"
,
ALIAS
,
NORID
},
{
"double"
,
TYPESPEC
,
RID_DOUBLE
},
{
""
,},
{
""
,},
{
"auto"
,
SCSPEC
,
RID_AUTO
},
{
""
,},
{
"goto"
,
GOTO
,
NORID
},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
"do"
,
DO
,
NORID
},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
"long"
,
TYPESPEC
,
RID_LONG
},
};
#ifdef __GNUC__
#ifdef __GNUC__
__inline
__inline
#endif
#endif
...
@@ -149,86 +262,6 @@ is_reserved_word (str, len)
...
@@ -149,86 +262,6 @@ is_reserved_word (str, len)
register
char
*
str
;
register
char
*
str
;
register
unsigned
int
len
;
register
unsigned
int
len
;
{
{
static
struct
resword
wordlist
[]
=
{
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
"int"
,
TYPESPEC
,
RID_INT
},
{
""
,},
{
"__signed"
,
TYPESPEC
,
RID_SIGNED
},
{
"__typeof__"
,
TYPEOF
,
NORID
},
{
"__signed__"
,
TYPESPEC
,
RID_SIGNED
},
{
"__imag__"
,
IMAGPART
,
NORID
},
{
"switch"
,
SWITCH
,
NORID
},
{
"__inline__"
,
SCSPEC
,
RID_INLINE
},
{
"else"
,
ELSE
,
NORID
},
{
"__iterator__"
,
SCSPEC
,
RID_ITERATOR
},
{
"__inline"
,
SCSPEC
,
RID_INLINE
},
{
"__extension__"
,
EXTENSION
,
NORID
},
{
"struct"
,
STRUCT
,
NORID
},
{
"__real__"
,
REALPART
,
NORID
},
{
"__asm__"
,
ASM_KEYWORD
,
NORID
},
{
"break"
,
BREAK
,
NORID
},
{
""
,},
{
"while"
,
WHILE
,
NORID
},
{
"__alignof__"
,
ALIGNOF
,
NORID
},
{
"__iterator"
,
SCSPEC
,
RID_ITERATOR
},
{
"__attribute__"
,
ATTRIBUTE
,
NORID
},
{
"__label__"
,
LABEL
,
NORID
},
{
"__const"
,
TYPE_QUAL
,
RID_CONST
},
{
"__attribute"
,
ATTRIBUTE
,
NORID
},
{
"__const__"
,
TYPE_QUAL
,
RID_CONST
},
{
"case"
,
CASE
,
NORID
},
{
"__complex__"
,
TYPESPEC
,
RID_COMPLEX
},
{
"inline"
,
SCSPEC
,
RID_INLINE
},
{
"__complex"
,
TYPESPEC
,
RID_COMPLEX
},
{
"if"
,
IF
,
NORID
},
{
"__real"
,
REALPART
,
NORID
},
{
"default"
,
DEFAULT
,
NORID
},
{
"__typeof"
,
TYPEOF
,
NORID
},
{
"sizeof"
,
SIZEOF
,
NORID
},
{
"extern"
,
SCSPEC
,
RID_EXTERN
},
{
"signed"
,
TYPESPEC
,
RID_SIGNED
},
{
"static"
,
SCSPEC
,
RID_STATIC
},
{
"do"
,
DO
,
NORID
},
{
"__imag"
,
IMAGPART
,
NORID
},
{
"void"
,
TYPESPEC
,
RID_VOID
},
{
"__asm"
,
ASM_KEYWORD
,
NORID
},
{
"return"
,
RETURN
,
NORID
},
{
"short"
,
TYPESPEC
,
RID_SHORT
},
{
"__volatile__"
,
TYPE_QUAL
,
RID_VOLATILE
},
{
""
,},
{
"char"
,
TYPESPEC
,
RID_CHAR
},
{
"__volatile"
,
TYPE_QUAL
,
RID_VOLATILE
},
{
"__alignof"
,
ALIGNOF
,
NORID
},
{
"typeof"
,
TYPEOF
,
NORID
},
{
"typedef"
,
SCSPEC
,
RID_TYPEDEF
},
{
"const"
,
TYPE_QUAL
,
RID_CONST
},
{
"for"
,
FOR
,
NORID
},
{
""
,},
{
""
,},
{
"auto"
,
SCSPEC
,
RID_AUTO
},
{
"unsigned"
,
TYPESPEC
,
RID_UNSIGNED
},
{
""
,},
{
"double"
,
TYPESPEC
,
RID_DOUBLE
},
{
"continue"
,
CONTINUE
,
NORID
},
{
""
,},
{
"register"
,
SCSPEC
,
RID_REGISTER
},
{
""
,},
{
""
,},
{
"volatile"
,
TYPE_QUAL
,
RID_VOLATILE
},
{
""
,},
{
""
,},
{
"asm"
,
ASM_KEYWORD
,
NORID
},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
"float"
,
TYPESPEC
,
RID_FLOAT
},
{
""
,},
{
""
,},
{
"goto"
,
GOTO
,
NORID
},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
""
,},
{
"long"
,
TYPESPEC
,
RID_LONG
},
{
""
,},
{
"enum"
,
ENUM
,
NORID
},
{
""
,},
{
"union"
,
UNION
,
NORID
},
};
if
(
len
<=
MAX_WORD_LENGTH
&&
len
>=
MIN_WORD_LENGTH
)
if
(
len
<=
MAX_WORD_LENGTH
&&
len
>=
MIN_WORD_LENGTH
)
{
{
register
int
key
=
hash
(
str
,
len
);
register
int
key
=
hash
(
str
,
len
);
...
@@ -260,6 +293,34 @@ make_pointer_declarator (type_quals, target)
...
@@ -260,6 +293,34 @@ make_pointer_declarator (type_quals, target)
}
}
void
void
forget_protocol_qualifiers
()
{
int
i
,
n
=
sizeof
wordlist
/
sizeof
(
struct
resword
);
for
(
i
=
0
;
i
<
n
;
i
++
)
if
(
wordlist
[
i
].
rid
>=
RID_IN
&&
wordlist
[
i
].
rid
<=
RID_ONEWAY
)
wordlist
[
i
].
name
=
""
;
}
void
remember_protocol_qualifiers
()
{
int
i
,
n
=
sizeof
wordlist
/
sizeof
(
struct
resword
);
for
(
i
=
0
;
i
<
n
;
i
++
)
if
(
wordlist
[
i
].
rid
==
RID_IN
)
wordlist
[
i
].
name
=
"in"
;
else
if
(
wordlist
[
i
].
rid
==
RID_OUT
)
wordlist
[
i
].
name
=
"out"
;
else
if
(
wordlist
[
i
].
rid
==
RID_INOUT
)
wordlist
[
i
].
name
=
"inout"
;
else
if
(
wordlist
[
i
].
rid
==
RID_BYCOPY
)
wordlist
[
i
].
name
=
"bycopy"
;
else
if
(
wordlist
[
i
].
rid
==
RID_ONEWAY
)
wordlist
[
i
].
name
=
"oneway"
;
}
void
init_lex
()
init_lex
()
{
{
/* Make identifier nodes long enough for the language-specific slots. */
/* Make identifier nodes long enough for the language-specific slots. */
...
@@ -296,6 +357,13 @@ init_lex ()
...
@@ -296,6 +357,13 @@ init_lex ()
ridpointers
[(
int
)
RID_REGISTER
]
=
get_identifier
(
"register"
);
ridpointers
[(
int
)
RID_REGISTER
]
=
get_identifier
(
"register"
);
ridpointers
[(
int
)
RID_ITERATOR
]
=
get_identifier
(
"iterator"
);
ridpointers
[(
int
)
RID_ITERATOR
]
=
get_identifier
(
"iterator"
);
ridpointers
[(
int
)
RID_COMPLEX
]
=
get_identifier
(
"complex"
);
ridpointers
[(
int
)
RID_COMPLEX
]
=
get_identifier
(
"complex"
);
ridpointers
[(
int
)
RID_ID
]
=
get_identifier
(
"id"
);
ridpointers
[(
int
)
RID_IN
]
=
get_identifier
(
"in"
);
ridpointers
[(
int
)
RID_OUT
]
=
get_identifier
(
"out"
);
ridpointers
[(
int
)
RID_INOUT
]
=
get_identifier
(
"inout"
);
ridpointers
[(
int
)
RID_BYCOPY
]
=
get_identifier
(
"bycopy"
);
ridpointers
[(
int
)
RID_ONEWAY
]
=
get_identifier
(
"oneway"
);
forget_protocol_qualifiers
();
/* Some options inhibit certain reserved words.
/* Some options inhibit certain reserved words.
Clear those words out of the hash table so they won't be recognized. */
Clear those words out of the hash table so they won't be recognized. */
...
@@ -303,6 +371,9 @@ init_lex ()
...
@@ -303,6 +371,9 @@ init_lex ()
do { struct resword *s = is_reserved_word (STRING, sizeof (STRING) - 1); \
do { struct resword *s = is_reserved_word (STRING, sizeof (STRING) - 1); \
if (s) s->name = ""; } while (0)
if (s) s->name = ""; } while (0)
if
(
!
doing_objc_thang
)
UNSET_RESERVED_WORD
(
"id"
);
if
(
flag_traditional
)
if
(
flag_traditional
)
{
{
UNSET_RESERVED_WORD
(
"const"
);
UNSET_RESERVED_WORD
(
"const"
);
...
@@ -341,6 +412,7 @@ yyprint (file, yychar, yylval)
...
@@ -341,6 +412,7 @@ yyprint (file, yychar, yylval)
{
{
case
IDENTIFIER
:
case
IDENTIFIER
:
case
TYPENAME
:
case
TYPENAME
:
case
OBJECTNAME
:
t
=
yylval
.
ttype
;
t
=
yylval
.
ttype
;
if
(
IDENTIFIER_POINTER
(
t
))
if
(
IDENTIFIER_POINTER
(
t
))
fprintf
(
file
,
" `%s'"
,
IDENTIFIER_POINTER
(
t
));
fprintf
(
file
,
" `%s'"
,
IDENTIFIER_POINTER
(
t
));
...
@@ -1005,6 +1077,7 @@ yylex ()
...
@@ -1005,6 +1077,7 @@ yylex ()
register
char
*
p
;
register
char
*
p
;
register
int
value
;
register
int
value
;
int
wide_flag
=
0
;
int
wide_flag
=
0
;
int
objc_flag
=
0
;
if
(
nextchar
>=
0
)
if
(
nextchar
>=
0
)
c
=
nextchar
,
nextchar
=
-
1
;
c
=
nextchar
,
nextchar
=
-
1
;
...
@@ -1078,28 +1151,19 @@ yylex ()
...
@@ -1078,28 +1151,19 @@ yylex ()
value
=
c
;
value
=
c
;
break
;
break
;
}
}
p
=
token_buffer
;
else
*
p
++
=
'@'
;
c
=
getc
(
finput
);
while
(
isalnum
(
c
)
||
c
==
'_'
)
{
{
if
(
p
>=
token_buffer
+
maxtoken
)
/* '@' may start a constant string object. */
p
=
extend_token_buffer
(
p
);
register
int
c
=
getc
(
finput
);
if
(
c
==
'"'
)
*
p
++
=
c
;
{
c
=
getc
(
finput
);
objc_flag
=
1
;
goto
string_constant
;
}
ungetc
(
c
,
finput
);
/* Fall through to treat '@' as the start of an indentifier. */
}
}
*
p
=
0
;
nextchar
=
c
;
value
=
recognize_objc_keyword
(
token_buffer
+
1
);
if
(
value
!=
0
)
break
;
error
(
"invalid Objective C keyword `%s'"
,
token_buffer
);
/* Cause a syntax error--1 is not a valid token type. */
value
=
1
;
break
;
case
'A'
:
case
'B'
:
case
'C'
:
case
'D'
:
case
'E'
:
case
'A'
:
case
'B'
:
case
'C'
:
case
'D'
:
case
'E'
:
case
'F'
:
case
'G'
:
case
'H'
:
case
'I'
:
case
'J'
:
case
'F'
:
case
'G'
:
case
'H'
:
case
'I'
:
case
'J'
:
case
'K'
:
case
'M'
:
case
'N'
:
case
'O'
:
case
'K'
:
case
'M'
:
case
'N'
:
case
'O'
:
...
@@ -1147,6 +1211,16 @@ yylex ()
...
@@ -1147,6 +1211,16 @@ yylex ()
yylval
.
ttype
=
ridpointers
[(
int
)
ptr
->
rid
];
yylval
.
ttype
=
ridpointers
[(
int
)
ptr
->
rid
];
value
=
(
int
)
ptr
->
token
;
value
=
(
int
)
ptr
->
token
;
/* Only return OBJECTNAME if it is a typedef. */
if
(
doing_objc_thang
&&
value
==
OBJECTNAME
)
{
lastiddecl
=
lookup_name
(
yylval
.
ttype
);
if
(
lastiddecl
==
NULL_TREE
||
TREE_CODE
(
lastiddecl
)
!=
TYPE_DECL
)
value
=
IDENTIFIER
;
}
/* Even if we decided to recognize asm, still perhaps warn. */
/* Even if we decided to recognize asm, still perhaps warn. */
if
(
pedantic
if
(
pedantic
&&
(
value
==
ASM_KEYWORD
||
value
==
TYPEOF
&&
(
value
==
ASM_KEYWORD
||
value
==
TYPEOF
...
@@ -1162,6 +1236,9 @@ yylex ()
...
@@ -1162,6 +1236,9 @@ yylex ()
if
(
value
==
IDENTIFIER
)
if
(
value
==
IDENTIFIER
)
{
{
if
(
token_buffer
[
0
]
==
'@'
)
error
(
"invalid identifier `%s'"
,
token_buffer
);
yylval
.
ttype
=
get_identifier
(
token_buffer
);
yylval
.
ttype
=
get_identifier
(
token_buffer
);
lastiddecl
=
lookup_name
(
yylval
.
ttype
);
lastiddecl
=
lookup_name
(
yylval
.
ttype
);
...
@@ -1186,7 +1263,7 @@ yylex ()
...
@@ -1186,7 +1263,7 @@ yylex ()
}
}
else
if
(
doing_objc_thang
)
else
if
(
doing_objc_thang
)
{
{
tree
objc_interface_decl
=
lookup_interfac
e
(
yylval
.
ttype
);
tree
objc_interface_decl
=
is_class_nam
e
(
yylval
.
ttype
);
if
(
objc_interface_decl
)
if
(
objc_interface_decl
)
{
{
...
@@ -1877,17 +1954,28 @@ yylex ()
...
@@ -1877,17 +1954,28 @@ yylex ()
#endif
#endif
yylval
.
ttype
=
build_string
((
len
+
1
)
*
WCHAR_BYTES
,
widep
);
yylval
.
ttype
=
build_string
((
len
+
1
)
*
WCHAR_BYTES
,
widep
);
TREE_TYPE
(
yylval
.
ttype
)
=
wchar_array_type_node
;
TREE_TYPE
(
yylval
.
ttype
)
=
wchar_array_type_node
;
value
=
STRING
;
}
else
if
(
objc_flag
)
{
extern
tree
build_objc_string
();
/* Return an Objective-C @"..." constant string object. */
yylval
.
ttype
=
build_objc_string
(
p
-
token_buffer
,
token_buffer
+
1
);
TREE_TYPE
(
yylval
.
ttype
)
=
char_array_type_node
;
value
=
OBJC_STRING
;
}
}
else
else
{
{
yylval
.
ttype
=
build_string
(
p
-
token_buffer
,
token_buffer
+
1
);
yylval
.
ttype
=
build_string
(
p
-
token_buffer
,
token_buffer
+
1
);
TREE_TYPE
(
yylval
.
ttype
)
=
char_array_type_node
;
TREE_TYPE
(
yylval
.
ttype
)
=
char_array_type_node
;
value
=
STRING
;
}
}
*
p
++
=
'"'
;
*
p
++
=
'"'
;
*
p
=
0
;
*
p
=
0
;
value
=
STRING
;
break
;
break
;
}
}
case
'+'
:
case
'+'
:
...
...
gcc/c-parse.in
View file @
e31c7eec
...
@@ -160,7 +160,11 @@ void yyerror ();
...
@@ -160,7 +160,11 @@ void yyerror ();
/* The Objective-C keywords. These are included in C and in
/* The Objective-C keywords. These are included in C and in
Objective C, so that the token codes are the same in both. */
Objective C, so that the token codes are the same in both. */
%
token
INTERFACE
IMPLEMENTATION
END
SELECTOR
DEFS
ENCODE
%
token
INTERFACE
IMPLEMENTATION
END
SELECTOR
DEFS
ENCODE
%
token
CLASSNAME
PUBLIC
%
token
CLASSNAME
PUBLIC
PRIVATE
PROTECTED
PROTOCOL
OBJECTNAME
CLASS
ALIAS
/* Objective-C string constants in raw form.
yylval is an OBJC_STRING_CST node. */
%
token
OBJC_STRING
%
type
<
code
>
unop
%
type
<
code
>
unop
...
@@ -206,7 +210,8 @@ ifobjc
...
@@ -206,7 +210,8 @@ ifobjc
%
type
<
ttype
>
keywordexpr
keywordarglist
keywordarg
%
type
<
ttype
>
keywordexpr
keywordarglist
keywordarg
%
type
<
ttype
>
myparms
myparm
optparmlist
reservedwords
objcselectorexpr
%
type
<
ttype
>
myparms
myparm
optparmlist
reservedwords
objcselectorexpr
%
type
<
ttype
>
selectorarg
keywordnamelist
keywordname
objcencodeexpr
%
type
<
ttype
>
selectorarg
keywordnamelist
keywordname
objcencodeexpr
%
type
<
ttype
>
CLASSNAME
%
type
<
ttype
>
objc_string
protocolrefs
identifier_list
objcprotocolexpr
%
type
<
ttype
>
CLASSNAME
OBJC_STRING
OBJECTNAME
end
ifobjc
end
ifobjc
%
{
%
{
...
@@ -350,8 +355,8 @@ identifier:
...
@@ -350,8 +355,8 @@ identifier:
IDENTIFIER
IDENTIFIER
|
TYPENAME
|
TYPENAME
ifobjc
ifobjc
|
OBJECTNAME
|
CLASSNAME
|
CLASSNAME
{
$$
=
CLASS_NAME
(
$
1
);
}
end
ifobjc
end
ifobjc
;
;
...
@@ -534,14 +539,21 @@ primary:
...
@@ -534,14 +539,21 @@ primary:
if
(
yychar
==
'('
)
if
(
yychar
==
'('
)
{
{
ifobjc
ifobjc
tree
decl
;
if
(
objc_receiver_context
if
(
objc_receiver_context
&&
!
(
objc_receiver_context
&&
!
(
objc_receiver_context
&&
strcmp
(
IDENTIFIER_POINTER
(
$
1
),
"super"
)))
&&
strcmp
(
IDENTIFIER_POINTER
(
$
1
),
"super"
)))
/* we have a message to super */
/* we have a message to super */
$$
=
get_super_receiver
();
$$
=
get_super_receiver
();
else
if
(
objc_method_context
else
if
(
objc_method_context
&&
is_ivar
(
objc_ivar_chain
,
$
1
))
&&
(
decl
=
is_ivar
(
objc_ivar_chain
,
$
1
)))
$$
=
build_ivar_reference
(
$
1
);
{
if
(
is_private
(
decl
))
$$
=
error_mark_node
;
else
$$
=
build_ivar_reference
(
$
1
);
}
else
else
end
ifobjc
end
ifobjc
{
{
...
@@ -560,13 +572,20 @@ end ifobjc
...
@@ -560,13 +572,20 @@ end ifobjc
else
else
{
{
ifobjc
ifobjc
tree
decl
;
if
(
objc_receiver_context
if
(
objc_receiver_context
&&
!
strcmp
(
IDENTIFIER_POINTER
(
$
1
),
"super"
))
&&
!
strcmp
(
IDENTIFIER_POINTER
(
$
1
),
"super"
))
/* we have a message to super */
/* we have a message to super */
$$
=
get_super_receiver
();
$$
=
get_super_receiver
();
else
if
(
objc_method_context
else
if
(
objc_method_context
&&
is_ivar
(
objc_ivar_chain
,
$
1
))
&&
(
decl
=
is_ivar
(
objc_ivar_chain
,
$
1
)))
$$
=
build_ivar_reference
(
$
1
);
{
if
(
is_private
(
decl
))
$$
=
error_mark_node
;
else
$$
=
build_ivar_reference
(
$
1
);
}
else
else
end
ifobjc
end
ifobjc
{
{
...
@@ -646,14 +665,21 @@ ifobjc
...
@@ -646,14 +665,21 @@ ifobjc
||
(
objc_receiver_context
||
(
objc_receiver_context
&&
strcmp
(
IDENTIFIER_POINTER
(
$
1
),
"super"
)))
&&
strcmp
(
IDENTIFIER_POINTER
(
$
1
),
"super"
)))
{
{
tree
decl
;
if
(
objc_method_context
if
(
objc_method_context
&&
is_ivar
(
objc_ivar_chain
,
$
1
))
&&
(
decl
=
is_ivar
(
objc_ivar_chain
,
$
1
)
))
{
{
if
(
IDENTIFIER_LOCAL_VALUE
(
$
1
))
if
(
IDENTIFIER_LOCAL_VALUE
(
$
1
))
warning
(
"local declaration of `%s' hides instance variable"
,
warning
(
"local declaration of `%s' hides instance variable"
,
IDENTIFIER_POINTER
(
$
1
));
IDENTIFIER_POINTER
(
$
1
));
else
else
$$
=
build_ivar_reference
(
$
1
);
{
if
(
is_private
(
decl
))
$$
=
error_mark_node
;
else
$$
=
build_ivar_reference
(
$
1
);
}
}
}
}
}
else
/* we have a message to super */
else
/* we have a message to super */
...
@@ -756,8 +782,12 @@ ifobjc
...
@@ -756,8 +782,12 @@ ifobjc
{
$$
=
build_message_expr
(
$
1
);
}
{
$$
=
build_message_expr
(
$
1
);
}
|
objcselectorexpr
|
objcselectorexpr
{
$$
=
build_selector_expr
(
$
1
);
}
{
$$
=
build_selector_expr
(
$
1
);
}
|
objcprotocolexpr
{
$$
=
build_protocol_expr
(
$
1
);
}
|
objcencodeexpr
|
objcencodeexpr
{
$$
=
build_encode_expr
(
$
1
);
}
{
$$
=
build_encode_expr
(
$
1
);
}
|
objc_string
{
$$
=
build_objc_string_object
(
$
1
);
}
end
ifobjc
end
ifobjc
;
;
...
@@ -768,6 +798,16 @@ string:
...
@@ -768,6 +798,16 @@ string:
{
$$
=
chainon
(
$
1
,
$
2
);
}
{
$$
=
chainon
(
$
1
,
$
2
);
}
;
;
ifobjc
/* Produces an OBJC_STRING_CST with prehaps more OBJC_STRING_CSTs chained
onto it. */
objc_string
:
OBJC_STRING
|
objc_string
OBJC_STRING
{
$$
=
chainon
(
$
1
,
$
2
);
}
;
end
ifobjc
xdecls
:
xdecls
:
/* empty */
/* empty */
|
datadecls
|
datadecls
...
@@ -932,8 +972,10 @@ typespec: TYPESPEC
...
@@ -932,8 +972,10 @@ typespec: TYPESPEC
In case of `foo foo, bar;'. */
In case of `foo foo, bar;'. */
$$
=
lookup_name
(
$
1
);
}
$$
=
lookup_name
(
$
1
);
}
ifobjc
ifobjc
|
CLASSNAME
|
CLASSNAME
protocolrefs
{
$$
=
get_static_reference
(
$
1
);
}
{
$$
=
get_static_reference
(
$
1
,
$
2
);
}
|
OBJECTNAME
protocolrefs
{
$$
=
get_object_reference
(
$
2
);
}
end
ifobjc
end
ifobjc
|
TYPEOF
'('
expr
')'
|
TYPEOF
'('
expr
')'
{
$$
=
TREE_TYPE
(
$
3
);
}
{
$$
=
TREE_TYPE
(
$
3
);
}
...
@@ -1074,7 +1116,10 @@ initlist:
...
@@ -1074,7 +1116,10 @@ initlist:
{
$$
=
build_tree_list
(
NULL_TREE
,
$
1
);
}
{
$$
=
build_tree_list
(
NULL_TREE
,
$
1
);
}
|
initlist
','
init
|
initlist
','
init
{
$$
=
tree_cons
(
NULL_TREE
,
$
3
,
$
1
);
}
{
$$
=
tree_cons
(
NULL_TREE
,
$
3
,
$
1
);
}
/* These are for labeled elements. */
/* These are for labeled elements. The syntax for an array element
initializer conflicts with the syntax for an Objective-C message,
so don't include these productions in the Objective-C grammer. */
ifc
|
'['
expr_no_commas
ELLIPSIS
expr_no_commas
']'
init
|
'['
expr_no_commas
ELLIPSIS
expr_no_commas
']'
init
{
$$
=
build_tree_list
(
tree_cons
(
$
2
,
NULL_TREE
,
{
$$
=
build_tree_list
(
tree_cons
(
$
2
,
NULL_TREE
,
build_tree_list
(
$
4
,
NULL_TREE
)),
build_tree_list
(
$
4
,
NULL_TREE
)),
...
@@ -1088,6 +1133,7 @@ initlist:
...
@@ -1088,6 +1133,7 @@ initlist:
{
$$
=
build_tree_list
(
$
2
,
$
4
);
}
{
$$
=
build_tree_list
(
$
2
,
$
4
);
}
|
initlist
','
'['
expr_no_commas
']'
init
|
initlist
','
'['
expr_no_commas
']'
init
{
$$
=
tree_cons
(
$
4
,
$
6
,
$
1
);
}
{
$$
=
tree_cons
(
$
4
,
$
6
,
$
1
);
}
end
ifc
|
identifier
':'
init
|
identifier
':'
init
{
$$
=
build_tree_list
(
$
1
,
$
3
);
}
{
$$
=
build_tree_list
(
$
1
,
$
3
);
}
|
initlist
','
identifier
':'
init
|
initlist
','
identifier
':'
init
...
@@ -1161,6 +1207,9 @@ after_type_declarator:
...
@@ -1161,6 +1207,9 @@ after_type_declarator:
|
'*'
type_quals
after_type_declarator
%
prec
UNARY
|
'*'
type_quals
after_type_declarator
%
prec
UNARY
{
$$
=
make_pointer_declarator
(
$
2
,
$
3
);
}
{
$$
=
make_pointer_declarator
(
$
2
,
$
3
);
}
|
TYPENAME
|
TYPENAME
ifobjc
|
OBJECTNAME
end
ifobjc
;
;
/* Kinds of declarator that can appear in a parameter list
/* Kinds of declarator that can appear in a parameter list
...
@@ -1271,7 +1320,18 @@ component_decl_list2: /* empty */
...
@@ -1271,7 +1320,18 @@ component_decl_list2: /* empty */
ifobjc
ifobjc
/* foo(sizeof(struct{ @defs(ClassName)})); */
/* foo(sizeof(struct{ @defs(ClassName)})); */
|
DEFS
'('
CLASSNAME
')'
|
DEFS
'('
CLASSNAME
')'
{
$$
=
get_class_ivars
(
$
3
);
}
{
tree
interface
=
lookup_interface
(
$
3
);
if
(
interface
)
$$
=
get_class_ivars
(
interface
);
else
{
error
(
"Cannot find interface declaration for `%s'"
,
IDENTIFIER_POINTER
(
$
3
));
$$
=
NULL_TREE
;
}
}
end
ifobjc
end
ifobjc
;
;
...
@@ -2012,6 +2072,9 @@ ifobjc
...
@@ -2012,6 +2072,9 @@ ifobjc
objcdef
:
objcdef
:
classdef
classdef
|
classdecl
|
aliasdecl
|
protocoldef
|
methoddef
|
methoddef
|
END
|
END
{
{
...
@@ -2026,11 +2089,31 @@ objcdef:
...
@@ -2026,11 +2089,31 @@ objcdef:
}
}
;
;
/* A nonempty list of identifiers. */
identifier_list
:
identifier
{
$$
=
build_tree_list
(
NULL_TREE
,
$
1
);
}
|
identifier_list
','
identifier
{
$$
=
chainon
(
$
1
,
build_tree_list
(
NULL_TREE
,
$
3
));
}
;
classdecl
:
CLASS
identifier_list
';'
{
objc_declare_class
(
$
2
);
}
aliasdecl
:
ALIAS
identifier
identifier
';'
{
objc_declare_alias
(
$
2
,
$
3
);
}
classdef
:
classdef
:
INTERFACE
identifier
'{'
INTERFACE
identifier
protocolrefs
'{'
{
{
objc_interface_context
=
objc_ivar_context
objc_interface_context
=
objc_ivar_context
=
start_class
(
INTERFACE_TYPE
,
$
2
,
NULL_TREE
);
=
start_class
(
CLASS_INTERFACE_TYPE
,
$
2
,
NULL_TREE
,
$
3
);
objc_public_flag
=
0
;
objc_public_flag
=
0
;
}
}
ivar_decl_list
'}'
ivar_decl_list
'}'
...
@@ -2044,10 +2127,10 @@ classdef:
...
@@ -2044,10 +2127,10 @@ classdef:
objc_interface_context
=
NULL_TREE
;
objc_interface_context
=
NULL_TREE
;
}
}
|
INTERFACE
identifier
|
INTERFACE
identifier
protocolrefs
{
{
objc_interface_context
objc_interface_context
=
start_class
(
INTERFACE_TYPE
,
$
2
,
NULL_TREE
);
=
start_class
(
CLASS_INTERFACE_TYPE
,
$
2
,
NULL_TREE
,
$
3
);
continue_class
(
objc_interface_context
);
continue_class
(
objc_interface_context
);
}
}
methodprotolist
methodprotolist
...
@@ -2057,10 +2140,10 @@ classdef:
...
@@ -2057,10 +2140,10 @@ classdef:
objc_interface_context
=
NULL_TREE
;
objc_interface_context
=
NULL_TREE
;
}
}
|
INTERFACE
identifier
':'
identifier
'{'
|
INTERFACE
identifier
':'
identifier
protocolrefs
'{'
{
{
objc_interface_context
=
objc_ivar_context
objc_interface_context
=
objc_ivar_context
=
start_class
(
INTERFACE_TYPE
,
$
2
,
$
4
);
=
start_class
(
CLASS_INTERFACE_TYPE
,
$
2
,
$
4
,
$
5
);
objc_public_flag
=
0
;
objc_public_flag
=
0
;
}
}
ivar_decl_list
'}'
ivar_decl_list
'}'
...
@@ -2074,10 +2157,10 @@ classdef:
...
@@ -2074,10 +2157,10 @@ classdef:
objc_interface_context
=
NULL_TREE
;
objc_interface_context
=
NULL_TREE
;
}
}
|
INTERFACE
identifier
':'
identifier
|
INTERFACE
identifier
':'
identifier
protocolrefs
{
{
objc_interface_context
objc_interface_context
=
start_class
(
INTERFACE_TYPE
,
$
2
,
$
4
);
=
start_class
(
CLASS_INTERFACE_TYPE
,
$
2
,
$
4
,
$
5
);
continue_class
(
objc_interface_context
);
continue_class
(
objc_interface_context
);
}
}
methodprotolist
methodprotolist
...
@@ -2090,7 +2173,7 @@ classdef:
...
@@ -2090,7 +2173,7 @@ classdef:
|
IMPLEMENTATION
identifier
'{'
|
IMPLEMENTATION
identifier
'{'
{
{
objc_implementation_context
=
objc_ivar_context
objc_implementation_context
=
objc_ivar_context
=
start_class
(
IMPLEMENTATION_TYPE
,
$
2
,
NULL_TREE
);
=
start_class
(
CLASS_IMPLEMENTATION_TYPE
,
$
2
,
NULL_TREE
,
NULL_TREE
);
objc_public_flag
=
0
;
objc_public_flag
=
0
;
}
}
ivar_decl_list
'}'
ivar_decl_list
'}'
...
@@ -2102,7 +2185,7 @@ classdef:
...
@@ -2102,7 +2185,7 @@ classdef:
|
IMPLEMENTATION
identifier
|
IMPLEMENTATION
identifier
{
{
objc_implementation_context
objc_implementation_context
=
start_class
(
IMPLEMENTATION_TYPE
,
$
2
,
NULL_TREE
);
=
start_class
(
CLASS_IMPLEMENTATION_TYPE
,
$
2
,
NULL_TREE
,
NULL_TREE
);
objc_ivar_chain
objc_ivar_chain
=
continue_class
(
objc_implementation_context
);
=
continue_class
(
objc_implementation_context
);
}
}
...
@@ -2110,7 +2193,7 @@ classdef:
...
@@ -2110,7 +2193,7 @@ classdef:
|
IMPLEMENTATION
identifier
':'
identifier
'{'
|
IMPLEMENTATION
identifier
':'
identifier
'{'
{
{
objc_implementation_context
=
objc_ivar_context
objc_implementation_context
=
objc_ivar_context
=
start_class
(
IMPLEMENTATION_TYPE
,
$
2
,
$
4
);
=
start_class
(
CLASS_IMPLEMENTATION_TYPE
,
$
2
,
$
4
,
NULL_TREE
);
objc_public_flag
=
0
;
objc_public_flag
=
0
;
}
}
ivar_decl_list
'}'
ivar_decl_list
'}'
...
@@ -2122,15 +2205,15 @@ classdef:
...
@@ -2122,15 +2205,15 @@ classdef:
|
IMPLEMENTATION
identifier
':'
identifier
|
IMPLEMENTATION
identifier
':'
identifier
{
{
objc_implementation_context
objc_implementation_context
=
start_class
(
IMPLEMENTATION_TYPE
,
$
2
,
$
4
);
=
start_class
(
CLASS_IMPLEMENTATION_TYPE
,
$
2
,
$
4
,
NULL_TREE
);
objc_ivar_chain
objc_ivar_chain
=
continue_class
(
objc_implementation_context
);
=
continue_class
(
objc_implementation_context
);
}
}
|
INTERFACE
identifier
'('
identifier
')'
|
INTERFACE
identifier
'('
identifier
')'
protocolrefs
{
{
objc_interface_context
objc_interface_context
=
start_class
(
PROTOCOL_TYPE
,
$
2
,
$
4
);
=
start_class
(
CATEGORY_INTERFACE_TYPE
,
$
2
,
$
4
,
$
6
);
continue_class
(
objc_interface_context
);
continue_class
(
objc_interface_context
);
}
}
methodprotolist
methodprotolist
...
@@ -2143,17 +2226,52 @@ classdef:
...
@@ -2143,17 +2226,52 @@ classdef:
|
IMPLEMENTATION
identifier
'('
identifier
')'
|
IMPLEMENTATION
identifier
'('
identifier
')'
{
{
objc_implementation_context
objc_implementation_context
=
start_class
(
CATEGORY_
TYPE
,
$
2
,
$
4
);
=
start_class
(
CATEGORY_
IMPLEMENTATION_TYPE
,
$
2
,
$
4
,
NULL_TREE
);
objc_ivar_chain
objc_ivar_chain
=
continue_class
(
objc_implementation_context
);
=
continue_class
(
objc_implementation_context
);
}
}
;
;
protocoldef
:
PROTOCOL
identifier
protocolrefs
{
remember_protocol_qualifiers
();
objc_interface_context
=
start_protocol
(
PROTOCOL_INTERFACE_TYPE
,
$
2
,
$
3
);
}
methodprotolist
END
{
forget_protocol_qualifiers
();
finish_protocol
(
objc_interface_context
);
objc_interface_context
=
NULL_TREE
;
}
;
protocolrefs
:
/* empty */
{
$$
=
NULL_TREE
;
}
|
ARITHCOMPARE
identifier_list
ARITHCOMPARE
{
if
(
$
1
==
LT_EXPR
&&
$
3
==
GT_EXPR
)
$$
=
$
2
;
else
YYERROR1
;
}
;
ivar_decl_list
:
ivar_decl_list
:
ivar_decl
s
PUBLIC
{
objc_public_flag
=
1
;
}
ivar_decls
ivar_decl
_list
visibility_spec
ivar_decls
|
ivar_decls
|
ivar_decls
;
;
visibility_spec
:
PRIVATE
{
objc_public_flag
=
2
;
}
|
PROTECTED
{
objc_public_flag
=
0
;
}
|
PUBLIC
{
objc_public_flag
=
1
;
}
;
ivar_decls
:
ivar_decls
:
/* empty */
/* empty */
{
{
...
@@ -2225,6 +2343,7 @@ ivar_declarator:
...
@@ -2225,6 +2343,7 @@ ivar_declarator:
methoddef
:
methoddef
:
'+'
'+'
{
{
remember_protocol_qualifiers
();
if
(
objc_implementation_context
)
if
(
objc_implementation_context
)
objc_inherit_code
=
CLASS_METHOD_DECL
;
objc_inherit_code
=
CLASS_METHOD_DECL
;
else
else
...
@@ -2232,6 +2351,7 @@ methoddef:
...
@@ -2232,6 +2351,7 @@ methoddef:
}
}
methoddecl
methoddecl
{
{
forget_protocol_qualifiers
();
add_class_method
(
objc_implementation_context
,
$
3
);
add_class_method
(
objc_implementation_context
,
$
3
);
start_method_def
(
$
3
);
start_method_def
(
$
3
);
objc_method_context
=
$
3
;
objc_method_context
=
$
3
;
...
@@ -2248,6 +2368,7 @@ methoddef:
...
@@ -2248,6 +2368,7 @@ methoddef:
|
'-'
|
'-'
{
{
remember_protocol_qualifiers
();
if
(
objc_implementation_context
)
if
(
objc_implementation_context
)
objc_inherit_code
=
INSTANCE_METHOD_DECL
;
objc_inherit_code
=
INSTANCE_METHOD_DECL
;
else
else
...
@@ -2255,6 +2376,7 @@ methoddef:
...
@@ -2255,6 +2376,7 @@ methoddef:
}
}
methoddecl
methoddecl
{
{
forget_protocol_qualifiers
();
add_instance_method
(
objc_implementation_context
,
$
3
);
add_instance_method
(
objc_implementation_context
,
$
3
);
start_method_def
(
$
3
);
start_method_def
(
$
3
);
objc_method_context
=
$
3
;
objc_method_context
=
$
3
;
...
@@ -2424,6 +2546,7 @@ keywordselector:
...
@@ -2424,6 +2546,7 @@ keywordselector:
selector
:
selector
:
IDENTIFIER
IDENTIFIER
|
TYPENAME
|
TYPENAME
|
OBJECTNAME
|
reservedwords
|
reservedwords
;
;
...
@@ -2559,6 +2682,13 @@ objcselectorexpr:
...
@@ -2559,6 +2682,13 @@ objcselectorexpr:
}
}
;
;
objcprotocolexpr
:
PROTOCOL
'('
identifier
')'
{
$$
=
$
3
;
}
;
/* extension to support C-structures in the archiver */
/* extension to support C-structures in the archiver */
objcencodeexpr
:
objcencodeexpr
:
...
@@ -2570,44 +2700,3 @@ objcencodeexpr:
...
@@ -2570,44 +2700,3 @@ objcencodeexpr:
end
ifobjc
end
ifobjc
%%
%%
ifobjc
/* If STRING is the name of an Objective C @-keyword
(not including the @), return the token type for that keyword.
Otherwise return 0. */
int
recognize_objc_keyword
(
string
)
char
*
string
;
{
switch
(
string
[
0
])
{
case
'd'
:
if
(
!
strcmp
(
string
,
"defs"
))
return
DEFS
;
break
;
case
'e'
:
if
(
!
strcmp
(
string
,
"end"
))
return
END
;
if
(
!
strcmp
(
string
,
"encode"
))
return
ENCODE
;
break
;
case
'i'
:
if
(
!
strcmp
(
string
,
"interface"
))
return
INTERFACE
;
if
(
!
strcmp
(
string
,
"implementation"
))
return
IMPLEMENTATION
;
break
;
case
'p'
:
if
(
!
strcmp
(
string
,
"public"
))
return
PUBLIC
;
break
;
case
's'
:
if
(
!
strcmp
(
string
,
"selector"
))
return
SELECTOR
;
break
;
}
return
0
;
}
end
ifobjc
gcc/objc/objc-act.c
View file @
e31c7eec
This source diff could not be displayed because it is too large. You can
view the blob
instead.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment