aboutsummaryrefslogtreecommitdiff
path: root/source/compiler/dtcompilerparser.y
diff options
context:
space:
mode:
Diffstat (limited to 'source/compiler/dtcompilerparser.y')
-rw-r--r--source/compiler/dtcompilerparser.y50
1 files changed, 24 insertions, 26 deletions
diff --git a/source/compiler/dtcompilerparser.y b/source/compiler/dtcompilerparser.y
index ba9d2827e5aa..43eba4e9c8f6 100644
--- a/source/compiler/dtcompilerparser.y
+++ b/source/compiler/dtcompilerparser.y
@@ -169,9 +169,13 @@ void DtCompilerParsererror (char const *msg);
extern char *DtCompilerParsertext;
extern DT_FIELD *AslGbl_CurrentField;
+extern int DtLabelByteOffset;
extern UINT64 DtCompilerParserResult; /* Expression return value */
extern UINT64 DtCompilerParserlineno; /* Current line number */
+extern UINT32 DtTokenFirstLine;
+extern UINT32 DtTokenFirstColumn;
+
/* Bison/yacc configuration */
#define yytname DtCompilerParsername
@@ -186,42 +190,30 @@ extern UINT64 DtCompilerParserlineno; /* Current line number */
%}
-%code requires {
-
- typedef struct YYLTYPE {
- int first_line;
- int last_line;
- int first_column;
- int last_column;
- int first_byte_offset;
- } YYLTYPE;
-
- #define YYLTYPE_IS_DECLARED 1
-}
-
%union {
char *s;
DT_FIELD *f;
+ DT_TABLE_UNIT *u;
}
%type <f> Table
-%token <s> DT_PARSEOP_DATA
-%token <s> DT_PARSEOP_LABEL
-%token <s> DT_PARSEOP_STRING_DATA
-%token <s> DT_PARSEOP_LINE_CONTINUATION
-%type <s> Data
-%type <s> Datum
-%type <s> MultiLineData
-%type <s> MultiLineDataList
+%token <u> DT_PARSEOP_DATA
+%token <u> DT_PARSEOP_LABEL
+%token <u> DT_PARSEOP_STRING_DATA
+%token <u> DT_PARSEOP_LINE_CONTINUATION
+%type <u> Data
+%type <u> Datum
+%type <u> MultiLineData
+%type <u> MultiLineDataList
%%
Table
:
- FieldList { DtCompilerParserResult = 5;}
+ FieldList { }
;
FieldList
@@ -230,7 +222,7 @@ FieldList
;
Field
- : DT_PARSEOP_LABEL ':' Data { DtCreateField ($1, $3, (@3).first_line, (@1).first_byte_offset, (@1).first_column, (@3).first_column); }
+ : DT_PARSEOP_LABEL ':' Data { DtCreateField ($1, $3, DtLabelByteOffset); }
;
Data
@@ -240,7 +232,7 @@ Data
;
MultiLineDataList
- : MultiLineDataList MultiLineData { $$ = AcpiUtStrcat(AcpiUtStrcat($1, " "), $2); } /* combine the strings with strcat */
+ : MultiLineDataList MultiLineData { $$ = DtCreateTableUnit (AcpiUtStrcat(AcpiUtStrcat($1->Value, " "), $2->Value), $1->Line, $1->Column); } /* combine the strings with strcat */
| MultiLineData { $$ = $1; }
;
@@ -249,8 +241,14 @@ MultiLineData
;
Datum
- : DT_PARSEOP_DATA { DbgPrint (ASL_PARSE_OUTPUT, "parser data: [%s]\n", DtCompilerParserlval.s); $$ = AcpiUtStrdup(DtCompilerParserlval.s); }
- | DT_PARSEOP_STRING_DATA { DbgPrint (ASL_PARSE_OUTPUT, "parser string data: [%s]\n", DtCompilerParserlval.s); $$ = AcpiUtStrdup(DtCompilerParserlval.s); }
+ : DT_PARSEOP_DATA {
+ DbgPrint (ASL_PARSE_OUTPUT, "parser data: [%s]\n", DtCompilerParserlval.s);
+ $$ = DtCreateTableUnit (AcpiUtStrdup(DtCompilerParserlval.s), DtTokenFirstLine, DtTokenFirstColumn);
+ }
+ | DT_PARSEOP_STRING_DATA {
+ DbgPrint (ASL_PARSE_OUTPUT, "parser string data: [%s]\n", DtCompilerParserlval.s);
+ $$ = DtCreateTableUnit (AcpiUtStrdup(DtCompilerParserlval.s), DtTokenFirstLine, DtTokenFirstColumn);
+ }
;