aslcompiler.l revision 199767f8919635c4928607450d9e0abb932109ce
%{
/******************************************************************************
*
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#include "aslcompiler.y.h"
#include <stdlib.h>
#include <string.h>
/*
* Generation: Use the following command line:
*
* flex.exe -PAslCompiler -i -o$(InputPath).c $(InputPath)
*
* -i: Scanner must be case-insensitive
*/
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslscanner")
/* Local prototypes */
static void
AslDoLineDirective (void);
static char
AslDoComment (void);
static char
AslDoCommentType2 (void);
static char
AslDoStringLiteral (void);
static void
/*! [Begin] no source code translation */
%}
/* Definitions */
DigitChar [0-9]
RootChar [\\]
Nothing []
NamePathTail [.]{NameSeg}
%%
/* Rules */
[ ] { count (0); }
[\r] { count (0); } /* termination on both Unix and Windows */
[ \t] { count (0); }
else {yyterminate ();} }
/* ASL Extension: Standard C operators */
/* ASL Extension: Standard C assignment operators */
/*
* Begin standard ASL grammar
*/
0[xX]{HexDigitChar}+ |
/*
* The #line directive is emitted by the preprocessor and handled
* here in the main iASL lexer - simply set the line number and
* optionally the current filename.
*/
"#line" { AslDoLineDirective ();}
/****************************************************************************
*
* Main ASL operators
*
****************************************************************************/
/* Control method arguments and locals */
/****************************************************************************
*
* Resource Descriptor macros
*
****************************************************************************/
/****************************************************************************
*
* Keywords used as arguments to ASL operators and macros
*
****************************************************************************/
/* AccessAttribKeyword: Serial Bus Attributes (ACPI 5.0) */
/* AccessAttribKeyword: Legacy synonyms for above (pre-ACPI 5.0) */
/* AccessTypeKeyword: Field Access Types */
/* AddressingModeKeyword: Mode - Resource Descriptors (ACPI 5.0) */
/* AddressKeyword: ACPI memory range types */
/* BusMasterKeyword: DMA Bus Mastering */
/* ByteLengthKeyword: Bits per Byte - Resource Descriptors (ACPI 5.0) */
/* ClockPhaseKeyword: Resource Descriptors (ACPI 5.0) */
/* ClockPolarityKeyword: Resource Descriptors (ACPI 5.0) */
/* DecodeKeyword: Type of Memory Decoding - Resource Descriptors */
/* DmaTypeKeyword: DMA Types - DMA Resource Descriptor */
/* EndianKeyword: Endian type - Resource Descriptor (ACPI 5.0) */
/* ExtendedAttribKeyword: Bus attributes, AccessAs operator (ACPI 5.0) */
/* FlowControlKeyword: Resource Descriptors (ACPI 5.0) */
/* InterruptLevelKeyword: Interrupt Active Types */
/* InterruptTypeKeyword: Interrupt Types */
/* IoDecodeKeyword: Type of Memory Decoding - Resource Descriptors */
/* IoRestrictionKeyword: I/O Restriction - GPIO Resource Descriptors (ACPI 5.0) */
/* LockRuleKeyword: Global Lock use for Field Operator */
/* MatchOpKeyword: Types for Match Operator */
/* MaxKeyword: Max Range Type - Resource Descriptors */
/* MemTypeKeyword: Memory Types - Resource Descriptors */
/* MinKeyword: Min Range Type - Resource Descriptors */
/* ObjectTypeKeyword: ACPI Object Types */
/* ParityKeyword: Resource Descriptors (ACPI 5.0) */
/* PinConfigKeyword: Pin Configuration - GPIO Resource Descriptors (ACPI 5.0) */
/* PolarityKeyword: Resource Descriptors (ACPI 5.0) */
/* RangeTypeKeyword: I/O Range Types - Resource Descriptors */
/* ReadWriteKeyword: Memory Access Types - Resource Descriptors */
/* RegionSpaceKeyword: Operation Region Address Space Types */
/* ResourceTypeKeyword: Resource Usage - Resource Descriptors */
/* SerializeRuleKeyword: Control Method Serialization */
/* ShareTypeKeyword: Interrupt Sharing - Resource Descriptors */
/* SlaveModeKeyword: Resource Descriptors (ACPI 5.0) */
/* StopBitsKeyword: Resource Descriptors (ACPI 5.0) */
/* TransferWidthKeyword: DMA Widths - Fixed DMA Resource Descriptor (ACPI 5.0) */
/* TranslationKeyword: Translation Density Types - Resource Descriptors */
/* TypeKeyword: Translation Types - Resource Descriptors */
/* UpdateRuleKeyword: Field Update Rules */
/* WireModeKeyword: SPI Wire Mode - Resource Descriptors (ACPI 5.0) */
/* XferTypeKeyword: DMA Transfer Types */
/* ToPld macro */
/* printf debug macros */
/* Predefined compiler names */
{NameSeg} { char *s;
count (0);
{
strcpy (s, "____");
}
AslCompilerlval.s = s;
return (PARSEOP_NAMESEG); }
{NameString} { char *s;
count (0);
strcpy (s, AslCompilertext);
AslCompilerlval.s = s;
return (PARSEOP_NAMESTRING); }
. { count (1);
if (isprint ((int) *AslCompilertext))
{
"Invalid character (%c), expecting ASL keyword or name",
}
else
{
"Invalid character (0x%2.2X), expecting ASL keyword or name",
}
<<EOF>> { if (AslPopInputFileStack ())
{yyterminate();}
else
{return (PARSEOP_INCLUDE_END);} };
%%
/*! [End] no source code translation !*/
/*
* Bring in the scanner support routines
*/