dtparser.l revision 278970
1132624Smarcel%{ 2132624Smarcel/****************************************************************************** 3132624Smarcel * 4132624Smarcel * Module Name: dtparser.l - Flex input file for table compiler lexer 5132624Smarcel * 6132624Smarcel *****************************************************************************/ 7132624Smarcel 8132624Smarcel/* 9132624Smarcel * Copyright (C) 2000 - 2015, Intel Corp. 10132624Smarcel * All rights reserved. 11132624Smarcel * 12132624Smarcel * Redistribution and use in source and binary forms, with or without 13132624Smarcel * modification, are permitted provided that the following conditions 14132624Smarcel * are met: 15132624Smarcel * 1. Redistributions of source code must retain the above copyright 16132624Smarcel * notice, this list of conditions, and the following disclaimer, 17132624Smarcel * without modification. 18132624Smarcel * 2. Redistributions in binary form must reproduce at minimum a disclaimer 19132624Smarcel * substantially similar to the "NO WARRANTY" disclaimer below 20132624Smarcel * ("Disclaimer") and any redistribution must be conditioned upon 21132624Smarcel * including a substantially similar Disclaimer requirement for further 22132624Smarcel * binary redistribution. 23132624Smarcel * 3. Neither the names of the above-listed copyright holders nor the names 24132624Smarcel * of any contributors may be used to endorse or promote products derived 25132624Smarcel * from this software without specific prior written permission. 26132624Smarcel * 27132624Smarcel * Alternatively, this software may be distributed under the terms of the 28132624Smarcel * GNU General Public License ("GPL") version 2 as published by the Free 29132624Smarcel * Software Foundation. 30142151Skan * 31142151Skan * NO WARRANTY 32142151Skan * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 33142151Skan * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 34175808Sjhb * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 35178670Sjhb * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 36132624Smarcel * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 37132624Smarcel * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 38132624Smarcel * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 39178670Sjhb * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 40178670Sjhb * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 41142151Skan * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 42175808Sjhb * POSSIBILITY OF SUCH DAMAGES. 43149954Smarcel */ 44178713Sjhb 45178670Sjhb#include <contrib/dev/acpica/compiler/aslcompiler.h> 46132624Smarcel#include "dtparser.y.h" 47132624Smarcel 48178670Sjhb#define YY_NO_INPUT /* No file input, we use strings only */ 49142151Skan 50178670Sjhb#define _COMPONENT ACPI_COMPILER 51132624Smarcel ACPI_MODULE_NAME ("dtscanner") 52178713Sjhb%} 53132624Smarcel 54142151Skan%option noyywrap 55142151Skan%option nounput 56246893Smarcel 57246893SmarcelNumber [0-9a-fA-F]+ 58178670SjhbHexNumber 0[xX][0-9a-fA-F]+ 59178670SjhbDecimalNumber 0[dD][0-9]+ 60178670SjhbLabelRef $[a-zA-Z][0-9a-zA-Z]* 61132624SmarcelWhiteSpace [ \t\v\r]+ 62132624SmarcelNewLine [\n] 63178670Sjhb 64178670Sjhb%% 65175808Sjhb 66163439Sjhb\( return (EXPOP_PAREN_OPEN); 67163439Sjhb\) return (EXPOP_PAREN_CLOSE); 68163439Sjhb\~ return (EXPOP_ONES_COMPLIMENT); 69163439Sjhb\! return (EXPOP_LOGICAL_NOT); 70163439Sjhb\* return (EXPOP_MULTIPLY); 71163439Sjhb\/ return (EXPOP_DIVIDE); 72163439Sjhb\% return (EXPOP_MODULO); 73163439Sjhb\+ return (EXPOP_ADD); 74163439Sjhb\- return (EXPOP_SUBTRACT); 75163439Sjhb">>" return (EXPOP_SHIFT_RIGHT); 76163439Sjhb"<<" return (EXPOP_SHIFT_LEFT); 77163439Sjhb\< return (EXPOP_LESS); 78163439Sjhb\> return (EXPOP_GREATER); 79163439Sjhb"<=" return (EXPOP_LESS_EQUAL); 80163439Sjhb">=" return (EXPOP_GREATER_EQUAL); 81163439Sjhb"==" return (EXPOP_EQUAL); 82163439Sjhb"!=" return (EXPOP_NOT_EQUAL); 83163439Sjhb\& return (EXPOP_AND); 84163439Sjhb\^ return (EXPOP_XOR); 85163439Sjhb\| return (EXPOP_OR); 86178670Sjhb"&&" return (EXPOP_LOGICAL_AND); 87178670Sjhb"||" return (EXPOP_LOGICAL_OR); 88178670Sjhb<<EOF>> return (EXPOP_EOF); /* null end-of-string */ 89178670Sjhb 90178670Sjhb{LabelRef} return (EXPOP_LABEL); 91178670Sjhb{Number} return (EXPOP_NUMBER); 92178670Sjhb{HexNumber} return (EXPOP_HEX_NUMBER); 93178670Sjhb{NewLine} return (EXPOP_NEW_LINE); 94178670Sjhb{WhiteSpace} /* Ignore */ 95178670Sjhb 96178670Sjhb. return (EXPOP_EOF); 97178670Sjhb 98178670Sjhb%% 99178670Sjhb 100178670Sjhb/* 101178670Sjhb * Local support functions 102178670Sjhb */ 103178670SjhbYY_BUFFER_STATE LexBuffer; 104178670Sjhb 105178670Sjhb/****************************************************************************** 106178670Sjhb * 107178670Sjhb * FUNCTION: DtInitLexer, DtTerminateLexer 108178670Sjhb * 109178670Sjhb * PARAMETERS: String - Input string to be parsed 110178670Sjhb * 111178670Sjhb * RETURN: None 112178670Sjhb * 113178670Sjhb * DESCRIPTION: Initialization and termination routines for lexer. Lexer needs 114178670Sjhb * a buffer to handle strings instead of a file. 115178670Sjhb * 116178670Sjhb *****************************************************************************/ 117178670Sjhb 118178670Sjhbint 119178670SjhbDtInitLexer ( 120178670Sjhb char *String) 121178670Sjhb{ 122178670Sjhb 123178670Sjhb LexBuffer = yy_scan_string (String); 124178670Sjhb return (LexBuffer == NULL); 125178670Sjhb} 126178670Sjhb 127178670Sjhbvoid 128178670SjhbDtTerminateLexer ( 129178670Sjhb void) 130178670Sjhb{ 131178670Sjhb 132178713Sjhb yy_delete_buffer (LexBuffer); 133178670Sjhb} 134178670Sjhb