summaryrefslogtreecommitdiff
path: root/source/compiler/prscan.c
diff options
context:
space:
mode:
authorRobert Moore <Robert.Moore@intel.com>2012-03-28 14:18:42 -0700
committerRobert Moore <Robert.Moore@intel.com>2012-03-28 14:18:42 -0700
commit35f1292815ca3c315222ebac0c91c2bf0e495eee (patch)
treebdd9af568c6203cf1b75dee94c14f8eb451d72ec /source/compiler/prscan.c
parentb95bbfbb76da28dba54fd7120a71c1ee34388dad (diff)
iASL: Implement #line directive in compiler lexer.
Move main compiler support for #line from the parser to the lexer. This simplifies the implementation, and allows #line to appear within any ASL statement (the entire line where #line appears is simply removed from the input after the new line number is set.)
Diffstat (limited to 'source/compiler/prscan.c')
-rw-r--r--source/compiler/prscan.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/source/compiler/prscan.c b/source/compiler/prscan.c
index 5c8ca199a..e98e18603 100644
--- a/source/compiler/prscan.c
+++ b/source/compiler/prscan.c
@@ -732,6 +732,31 @@ PrDoDirective (
PrOpenIncludeFile (Token);
break;
+ case PR_DIRECTIVE_LINE:
+ TokenOffset = Token - Gbl_MainTokenBuffer;
+
+ Status = PrResolveIntegerExpression (
+ &Gbl_CurrentLineBuffer[TokenOffset-1], &Value);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
+ "User #line invocation %s\n", Gbl_CurrentLineNumber,
+ Token);
+
+ /* Update local line numbers */
+
+ Gbl_CurrentLineNumber = (UINT32) Value;
+ Gbl_PreviousLineNumber = 0;
+
+ /* Emit #line into the preprocessor file */
+
+ FlPrintFile (ASL_FILE_PREPROCESSOR, "#line %u \"%s\"\n",
+ Gbl_CurrentLineNumber, Gbl_Files[ASL_FILE_INPUT].Filename);
+ break;
+
case PR_DIRECTIVE_PRAGMA:
/* Only "#pragma message" supported at this time */
@@ -764,8 +789,6 @@ PrDoDirective (
THIS_TOKEN_OFFSET (Token));
break;
- case PR_DIRECTIVE_LINE:
- /* TBD: set line number -- or, do this in main compiler */
default:
/* Should never get here */
DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID