Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2215 → Rev 2216

/drivers/devman/acpica/compiler/aslcompiler.y
10,7 → 10,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
115,14 → 115,6
*
*****************************************************************************/
 
#define YYDEBUG 1
#define YYERROR_VERBOSE 1
 
/*
* State stack - compiler will fault if it overflows. (Default was 200)
*/
#define YYINITDEPTH 600
 
#include "aslcompiler.h"
#include <stdio.h>
#include <stdlib.h>
146,38 → 138,34
* ResourceMacroList, and FieldUnitList
*/
 
void * AslLocalAllocate (unsigned int Size);
 
/*
* Next statement is important - this makes everything public so that
* we can access some of the parser tables from other modules
*/
/* Bison/yacc configuration */
 
#define static
#undef alloca
#define alloca AslLocalAllocate
#define YYERROR_VERBOSE 1
#define yytname AslCompilername
 
void *
AslLocalAllocate (unsigned int Size);
#define YYINITDEPTH 600 /* State stack depth */
#define YYDEBUG 1 /* Enable debug output */
#define YYERROR_VERBOSE 1 /* Verbose error messages */
 
/*
* The windows version of bison defines this incorrectly as "32768" (Not negative).
* Using a custom (edited binary) version of bison that defines YYFLAG as YYFBAD
* We use a custom (edited binary) version of bison that defines YYFLAG as YYFBAD
* instead (#define YYFBAD 32768), so we can define it correctly here.
*
* The problem is that if YYFLAG is positive, the extended syntax error messages
* are disabled.
*/
 
#define YYFLAG -32768
 
 
%}
 
 
/*
* Declare the type of values in the grammar
*/
 
%union {
UINT64 i;
char *s;
184,7 → 172,6
ACPI_PARSE_OBJECT *n;
}
 
 
/*! [Begin] no source code translation */
 
/*
193,7 → 180,6
*/
%expect 60
 
 
/*
* Token types: These are returned by the lexer
*
200,7 → 186,6
* NOTE: This list MUST match the AslKeywordMapping table found
* in aslmap.c EXACTLY! Double check any changes!
*/
 
%token <i> PARSEOP_ACCESSAS
%token <i> PARSEOP_ACCESSATTRIB_BLOCK
%token <i> PARSEOP_ACCESSATTRIB_BLOCK_CALL
464,6 → 449,13
%token <i> PARSEOP_XOR
%token <i> PARSEOP_ZERO
 
/*
* Special functions. These should probably stay at the end of this
* table.
*/
%token <i> PARSEOP___DATE__
%token <i> PARSEOP___FILE__
%token <i> PARSEOP___LINE__
 
/*
* Production names
767,7 → 759,6
%type <n> OptionalReference
%type <n> OptionalAccessSize
 
 
%type <n> TermArgItem
%type <n> NameStringItem
 
794,6 → 785,21
| error {YYABORT; $$ = NULL;}
;
 
/*
* Note concerning support for "module-level code".
*
* ACPI 1.0 allowed Type1 and Type2 executable opcodes outside of control
* methods (the so-called module-level code.) This support was explicitly
* removed in ACPI 2.0, but this type of code continues to be created by
* BIOS vendors. In order to support the disassembly and recompilation of
* such code (and the porting of ASL code to iASL), iASL supports this
* code in violation of the current ACPI specification.
*
* The grammar change to support module-level code is to revert the
* {ObjectList} portion of the DefinitionBlockTerm in ACPI 2.0 to the
* original use of {TermList} instead (see below.) This allows the use
* of Type1 and Type2 opcodes at module level.
*/
DefinitionBlockTerm
: PARSEOP_DEFINITIONBLOCK '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEFINITIONBLOCK);}
String ','
1535,7 → 1541,7
: PARSEOP_RETURN '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RETURN);}
OptionalReturnArg
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_RETURN {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrCreateLeafNode (PARSEOP_ZERO));}
| PARSEOP_RETURN {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN));}
| PARSEOP_RETURN '('
error ')' {$$ = AslDoError(); yyclearin;}
;
2389,6 → 2395,9
: PARSEOP_ZERO {$$ = TrCreateValuedLeafNode (PARSEOP_ZERO, 0);}
| PARSEOP_ONE {$$ = TrCreateValuedLeafNode (PARSEOP_ONE, 1);}
| PARSEOP_ONES {$$ = TrCreateValuedLeafNode (PARSEOP_ONES, ACPI_UINT64_MAX);}
| PARSEOP___DATE__ {$$ = TrCreateConstantLeafNode (PARSEOP___DATE__);}
| PARSEOP___FILE__ {$$ = TrCreateConstantLeafNode (PARSEOP___FILE__);}
| PARSEOP___LINE__ {$$ = TrCreateConstantLeafNode (PARSEOP___LINE__);}
;
 
/* OptionalCount must appear before ByteList or an incorrect reduction will result */
3109,7 → 3118,7
;
 
OptionalReturnArg
: {$$ = TrCreateLeafNode (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */
: {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN);} /* Placeholder is a ZeroOp object */
| TermArg {$$ = $1;}
;
 
3142,7 → 3151,6
| ',' error {$$ = AslDoError (); yyclearin;}
;
 
 
%%
 
 
3187,3 → 3195,32
return (TrCreateLeafNode (PARSEOP_ERRORNODE));
 
}
 
 
/*******************************************************************************
*
* FUNCTION: UtGetOpName
*
* PARAMETERS: ParseOpcode - Parser keyword ID
*
* RETURN: Pointer to the opcode name
*
* DESCRIPTION: Get the ascii name of the parse opcode
*
******************************************************************************/
 
char *
UtGetOpName (
UINT32 ParseOpcode)
{
#ifdef ASL_YYTNAME_START
/*
* First entries (ASL_YYTNAME_START) in yytname are special reserved names.
* Ignore first 8 characters of the name
*/
return ((char *) yytname
[(ParseOpcode - ASL_FIRST_PARSE_OPCODE) + ASL_YYTNAME_START] + 8);
#else
return ("[Unknown parser generator]");
#endif
}