mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
support spaces in node names
This commit is contained in:
parent
b49c72cc5d
commit
0d8cfd3131
File diff suppressed because it is too large
Load Diff
@ -402,6 +402,7 @@ inline void accept() {
|
|||||||
INTEGERNUM ([+-]?([0-9]+))
|
INTEGERNUM ([+-]?([0-9]+))
|
||||||
REALNUM ([+-]?(([0-9]+[.])|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?)
|
REALNUM ([+-]?(([0-9]+[.])|([0-9]*[.][0-9]+))([eE][+-]?[0-9]+)?)
|
||||||
SEPARATOR [ \t;,]+
|
SEPARATOR [ \t;,]+
|
||||||
|
WHITESPACE [ ]+
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
@ -542,11 +543,11 @@ SEPARATOR [ \t;,]+
|
|||||||
return TOKEN_WORD;
|
return TOKEN_WORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
{INTEGERNUM} {
|
{INTEGERNUM}({WHITESPACE})? {
|
||||||
// A signed or unsigned integer number.
|
// A signed or unsigned integer number.
|
||||||
accept();
|
accept();
|
||||||
xyylval.u.number = atol(xyytext);
|
xyylval.u.number = atol(xyytext);
|
||||||
xyylval.str = yytext;
|
xyylval.str = trim_right(xyytext);
|
||||||
|
|
||||||
return TOKEN_INTEGER;
|
return TOKEN_INTEGER;
|
||||||
}
|
}
|
||||||
@ -603,6 +604,13 @@ SEPARATOR [ \t;,]+
|
|||||||
return TOKEN_NAME;
|
return TOKEN_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[0-9-]+[A-Za-z_-][A-Za-z_0-9-]* {
|
||||||
|
// Identifier with leading digit.
|
||||||
|
accept();
|
||||||
|
xyylval.str = xyytext;
|
||||||
|
return TOKEN_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
. {
|
. {
|
||||||
// Any other character is invalid.
|
// Any other character is invalid.
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,39 +1,110 @@
|
|||||||
#ifndef BISON_Y_TAB_H
|
/* A Bison parser, made by GNU Bison 1.875b. */
|
||||||
# define BISON_Y_TAB_H
|
|
||||||
|
|
||||||
# define TOKEN_NAME 1
|
/* Skeleton parser for Yacc-like parsing with Bison,
|
||||||
# define TOKEN_STRING 2
|
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||||
# define TOKEN_INTEGER 3
|
|
||||||
# define TOKEN_GUID 5
|
|
||||||
# define TOKEN_INTEGER_LIST 6
|
|
||||||
# define TOKEN_REALNUM_LIST 7
|
|
||||||
# define TOKEN_OBRACE 10
|
|
||||||
# define TOKEN_CBRACE 11
|
|
||||||
# define TOKEN_OPAREN 12
|
|
||||||
# define TOKEN_CPAREN 13
|
|
||||||
# define TOKEN_OBRACKET 14
|
|
||||||
# define TOKEN_CBRACKET 15
|
|
||||||
# define TOKEN_OANGLE 16
|
|
||||||
# define TOKEN_CANGLE 17
|
|
||||||
# define TOKEN_DOT 18
|
|
||||||
# define TOKEN_COMMA 19
|
|
||||||
# define TOKEN_SEMICOLON 20
|
|
||||||
# define TOKEN_TEMPLATE 31
|
|
||||||
# define TOKEN_WORD 40
|
|
||||||
# define TOKEN_DWORD 41
|
|
||||||
# define TOKEN_FLOAT 42
|
|
||||||
# define TOKEN_DOUBLE 43
|
|
||||||
# define TOKEN_CHAR 44
|
|
||||||
# define TOKEN_UCHAR 45
|
|
||||||
# define TOKEN_SWORD 46
|
|
||||||
# define TOKEN_SDWORD 47
|
|
||||||
# define TOKEN_VOID 48
|
|
||||||
# define TOKEN_LPSTR 49
|
|
||||||
# define TOKEN_UNICODE 50
|
|
||||||
# define TOKEN_CSTRING 51
|
|
||||||
# define TOKEN_ARRAY 52
|
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
/* As a special exception, when this file is copied by Bison into a
|
||||||
|
Bison output file, you may use that output file without restriction.
|
||||||
|
This special exception was added by the Free Software Foundation
|
||||||
|
in version 1.24 of Bison. */
|
||||||
|
|
||||||
|
/* Tokens. */
|
||||||
|
#ifndef YYTOKENTYPE
|
||||||
|
# define YYTOKENTYPE
|
||||||
|
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||||
|
know about them. */
|
||||||
|
enum yytokentype {
|
||||||
|
TOKEN_NAME = 1,
|
||||||
|
TOKEN_STRING = 2,
|
||||||
|
TOKEN_INTEGER = 3,
|
||||||
|
TOKEN_GUID = 5,
|
||||||
|
TOKEN_INTEGER_LIST = 6,
|
||||||
|
TOKEN_REALNUM_LIST = 7,
|
||||||
|
TOKEN_OBRACE = 10,
|
||||||
|
TOKEN_CBRACE = 11,
|
||||||
|
TOKEN_OPAREN = 12,
|
||||||
|
TOKEN_CPAREN = 13,
|
||||||
|
TOKEN_OBRACKET = 14,
|
||||||
|
TOKEN_CBRACKET = 15,
|
||||||
|
TOKEN_OANGLE = 16,
|
||||||
|
TOKEN_CANGLE = 17,
|
||||||
|
TOKEN_DOT = 18,
|
||||||
|
TOKEN_COMMA = 19,
|
||||||
|
TOKEN_SEMICOLON = 20,
|
||||||
|
TOKEN_TEMPLATE = 31,
|
||||||
|
TOKEN_WORD = 40,
|
||||||
|
TOKEN_DWORD = 41,
|
||||||
|
TOKEN_FLOAT = 42,
|
||||||
|
TOKEN_DOUBLE = 43,
|
||||||
|
TOKEN_CHAR = 44,
|
||||||
|
TOKEN_UCHAR = 45,
|
||||||
|
TOKEN_SWORD = 46,
|
||||||
|
TOKEN_SDWORD = 47,
|
||||||
|
TOKEN_VOID = 48,
|
||||||
|
TOKEN_LPSTR = 49,
|
||||||
|
TOKEN_UNICODE = 50,
|
||||||
|
TOKEN_CSTRING = 51,
|
||||||
|
TOKEN_ARRAY = 52
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
#define TOKEN_NAME 1
|
||||||
|
#define TOKEN_STRING 2
|
||||||
|
#define TOKEN_INTEGER 3
|
||||||
|
#define TOKEN_GUID 5
|
||||||
|
#define TOKEN_INTEGER_LIST 6
|
||||||
|
#define TOKEN_REALNUM_LIST 7
|
||||||
|
#define TOKEN_OBRACE 10
|
||||||
|
#define TOKEN_CBRACE 11
|
||||||
|
#define TOKEN_OPAREN 12
|
||||||
|
#define TOKEN_CPAREN 13
|
||||||
|
#define TOKEN_OBRACKET 14
|
||||||
|
#define TOKEN_CBRACKET 15
|
||||||
|
#define TOKEN_OANGLE 16
|
||||||
|
#define TOKEN_CANGLE 17
|
||||||
|
#define TOKEN_DOT 18
|
||||||
|
#define TOKEN_COMMA 19
|
||||||
|
#define TOKEN_SEMICOLON 20
|
||||||
|
#define TOKEN_TEMPLATE 31
|
||||||
|
#define TOKEN_WORD 40
|
||||||
|
#define TOKEN_DWORD 41
|
||||||
|
#define TOKEN_FLOAT 42
|
||||||
|
#define TOKEN_DOUBLE 43
|
||||||
|
#define TOKEN_CHAR 44
|
||||||
|
#define TOKEN_UCHAR 45
|
||||||
|
#define TOKEN_SWORD 46
|
||||||
|
#define TOKEN_SDWORD 47
|
||||||
|
#define TOKEN_VOID 48
|
||||||
|
#define TOKEN_LPSTR 49
|
||||||
|
#define TOKEN_UNICODE 50
|
||||||
|
#define TOKEN_CSTRING 51
|
||||||
|
#define TOKEN_ARRAY 52
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
||||||
|
typedef int YYSTYPE;
|
||||||
|
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||||
|
# define YYSTYPE_IS_DECLARED 1
|
||||||
|
# define YYSTYPE_IS_TRIVIAL 1
|
||||||
|
#endif
|
||||||
|
|
||||||
extern YYSTYPE xyylval;
|
extern YYSTYPE xyylval;
|
||||||
|
|
||||||
#endif /* not BISON_Y_TAB_H */
|
|
||||||
|
|
||||||
|
@ -94,8 +94,9 @@ x_cleanup_parser() {
|
|||||||
%type <u.primitive_type> primitive_type
|
%type <u.primitive_type> primitive_type
|
||||||
%type <int_list> integer_list
|
%type <int_list> integer_list
|
||||||
%type <double_list> realnum_list
|
%type <double_list> realnum_list
|
||||||
%type <str> name
|
%type <str> singleword_name
|
||||||
%type <str> optional_name
|
%type <str> multiword_name
|
||||||
|
%type <str> optional_multiword_name
|
||||||
%type <str> string
|
%type <str> string
|
||||||
%type <guid> class_id
|
%type <guid> class_id
|
||||||
%type <guid> optional_class_id
|
%type <guid> optional_class_id
|
||||||
@ -111,7 +112,7 @@ xfile:
|
|||||||
;
|
;
|
||||||
|
|
||||||
template:
|
template:
|
||||||
TOKEN_TEMPLATE name TOKEN_OBRACE class_id
|
TOKEN_TEMPLATE singleword_name TOKEN_OBRACE class_id
|
||||||
{
|
{
|
||||||
$$ = current_node;
|
$$ = current_node;
|
||||||
XFileTemplate *templ = new XFileTemplate(x_file, $2, $4);
|
XFileTemplate *templ = new XFileTemplate(x_file, $2, $4);
|
||||||
@ -155,7 +156,7 @@ template_members:
|
|||||||
;
|
;
|
||||||
|
|
||||||
primitive:
|
primitive:
|
||||||
primitive_type optional_name TOKEN_SEMICOLON
|
primitive_type optional_multiword_name TOKEN_SEMICOLON
|
||||||
{
|
{
|
||||||
current_data_def = new XFileDataDef(x_file, $2, $1);
|
current_data_def = new XFileDataDef(x_file, $2, $1);
|
||||||
current_node->add_child(current_data_def);
|
current_node->add_child(current_data_def);
|
||||||
@ -167,7 +168,7 @@ array:
|
|||||||
;
|
;
|
||||||
|
|
||||||
template_reference:
|
template_reference:
|
||||||
name optional_name TOKEN_SEMICOLON
|
singleword_name optional_multiword_name TOKEN_SEMICOLON
|
||||||
{
|
{
|
||||||
XFileTemplate *xtemplate = x_file->find_template($1);
|
XFileTemplate *xtemplate = x_file->find_template($1);
|
||||||
if (xtemplate == (XFileTemplate *)NULL) {
|
if (xtemplate == (XFileTemplate *)NULL) {
|
||||||
@ -227,12 +228,12 @@ primitive_type:
|
|||||||
;
|
;
|
||||||
|
|
||||||
array_data_type:
|
array_data_type:
|
||||||
primitive_type name
|
primitive_type multiword_name
|
||||||
{
|
{
|
||||||
current_data_def = new XFileDataDef(x_file, $2, $1);
|
current_data_def = new XFileDataDef(x_file, $2, $1);
|
||||||
current_node->add_child(current_data_def);
|
current_node->add_child(current_data_def);
|
||||||
}
|
}
|
||||||
| name name
|
| singleword_name multiword_name
|
||||||
{
|
{
|
||||||
XFileTemplate *xtemplate = x_file->find_template($1);
|
XFileTemplate *xtemplate = x_file->find_template($1);
|
||||||
if (xtemplate == (XFileTemplate *)NULL) {
|
if (xtemplate == (XFileTemplate *)NULL) {
|
||||||
@ -258,7 +259,7 @@ dimension_size:
|
|||||||
{
|
{
|
||||||
current_data_def->add_array_def(XFileArrayDef($1));
|
current_data_def->add_array_def(XFileArrayDef($1));
|
||||||
}
|
}
|
||||||
| name
|
| multiword_name
|
||||||
{
|
{
|
||||||
XFileNode *data_def = current_node->find_child($1);
|
XFileNode *data_def = current_node->find_child($1);
|
||||||
if (data_def == (XFileNode *)NULL) {
|
if (data_def == (XFileNode *)NULL) {
|
||||||
@ -279,7 +280,7 @@ template_option_list:
|
|||||||
;
|
;
|
||||||
|
|
||||||
template_option_part:
|
template_option_part:
|
||||||
name
|
singleword_name
|
||||||
{
|
{
|
||||||
XFileTemplate *xtemplate = x_file->find_template($1);
|
XFileTemplate *xtemplate = x_file->find_template($1);
|
||||||
if (xtemplate == (XFileTemplate *)NULL) {
|
if (xtemplate == (XFileTemplate *)NULL) {
|
||||||
@ -288,7 +289,7 @@ template_option_part:
|
|||||||
DCAST(XFileTemplate, current_node)->add_option(xtemplate);
|
DCAST(XFileTemplate, current_node)->add_option(xtemplate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| name class_id
|
| singleword_name class_id
|
||||||
{
|
{
|
||||||
XFileTemplate *xtemplate = x_file->find_template($2);
|
XFileTemplate *xtemplate = x_file->find_template($2);
|
||||||
if (xtemplate == (XFileTemplate *)NULL) {
|
if (xtemplate == (XFileTemplate *)NULL) {
|
||||||
@ -303,16 +304,28 @@ template_option_part:
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
name:
|
singleword_name:
|
||||||
|
TOKEN_NAME
|
||||||
|
;
|
||||||
|
|
||||||
|
multiword_name:
|
||||||
TOKEN_NAME
|
TOKEN_NAME
|
||||||
|
| multiword_name TOKEN_NAME
|
||||||
|
{
|
||||||
|
$$ = $1 + " " + $2;
|
||||||
|
}
|
||||||
|
| multiword_name TOKEN_INTEGER
|
||||||
|
{
|
||||||
|
$$ = $1 + " " + $<str>2;
|
||||||
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
optional_name:
|
optional_multiword_name:
|
||||||
empty
|
empty
|
||||||
{
|
{
|
||||||
$$ = string();
|
$$ = string();
|
||||||
}
|
}
|
||||||
| name
|
| multiword_name
|
||||||
;
|
;
|
||||||
|
|
||||||
class_id:
|
class_id:
|
||||||
@ -332,7 +345,7 @@ ellipsis:
|
|||||||
;
|
;
|
||||||
|
|
||||||
object:
|
object:
|
||||||
name optional_name TOKEN_OBRACE
|
singleword_name optional_multiword_name TOKEN_OBRACE
|
||||||
{
|
{
|
||||||
XFileTemplate *xtemplate = x_file->find_template($1);
|
XFileTemplate *xtemplate = x_file->find_template($1);
|
||||||
$$ = current_node;
|
$$ = current_node;
|
||||||
@ -413,7 +426,7 @@ list_separator:
|
|||||||
;
|
;
|
||||||
|
|
||||||
data_reference:
|
data_reference:
|
||||||
name
|
multiword_name
|
||||||
{
|
{
|
||||||
XFileDataNodeTemplate *data_object = x_file->find_data_object($1);
|
XFileDataNodeTemplate *data_object = x_file->find_data_object($1);
|
||||||
if (data_object == (XFileDataObject *)NULL) {
|
if (data_object == (XFileDataObject *)NULL) {
|
||||||
@ -422,7 +435,7 @@ data_reference:
|
|||||||
|
|
||||||
$$ = new XFileDataNodeReference(data_object);
|
$$ = new XFileDataNodeReference(data_object);
|
||||||
}
|
}
|
||||||
| name class_id
|
| multiword_name class_id
|
||||||
{
|
{
|
||||||
XFileDataNodeTemplate *data_object = x_file->find_data_object($2);
|
XFileDataNodeTemplate *data_object = x_file->find_data_object($2);
|
||||||
if (data_object == (XFileDataObject *)NULL) {
|
if (data_object == (XFileDataObject *)NULL) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user