1 %{ 2 /* 3 * CDDL HEADER START 4 * 5 * The contents of this file are subject to the terms of the 6 * Common Development and Distribution License (the "License"). 7 * You may not use this file except in compliance with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 * 22 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #include <locale.h> 27 #include "y.tab.h" 28 29 extern int base; 30 31 int cmd_no = 1; 32 33 %} 34 35 %e 2000 36 37 WS [ \t] 38 39 %% 40 41 \n { cmd_no++; return NL; } 42 \. { return DOT; } 43 44 ;{WS}*:{WS}*base{WS}* { return BASE; } 45 ^{WS}*:{WS}*base{WS}* { return BASE; } 46 {WS}*:{WS}*block{WS}* { return BLOCK; } 47 ;{WS}*:{WS}*cd { return CD; } 48 ^{WS}*:{WS}*cd { return CD; } 49 :{WS}*directory{WS}* { return DIRECTORY; } 50 :{WS}*file{WS}* { return TFILE; } 51 ;{WS}*:{WS}*find{WS}* { return FIND; } 52 ^{WS}*:{WS}*find{WS}* { return FIND; } 53 {WS}*:{WS}*fill{WS}* { return FILL; } 54 :{WS}*inode{WS}* { return INODE; } 55 ;{WS}*:{WS}*ls { return LS; } 56 ^{WS}*:{WS}*ls { return LS; } 57 ;{WS}*:{WS}*override{WS}* { return OVERRIDE; } 58 ^{WS}*:{WS}*override{WS}* { return OVERRIDE; } 59 ;{WS}*:{WS}*prompt{WS}* { return PROMPT; } 60 ^{WS}*:{WS}*prompt{WS}* { return PROMPT; } 61 ;{WS}*:{WS}*pwd{WS}* { return PWD; } 62 ^{WS}*:{WS}*pwd{WS}* { return PWD; } 63 ;{WS}*:{WS}*quit{WS}* { return QUIT; } 64 ^{WS}*:{WS}*quit{WS}* { return QUIT; } 65 :{WS}*tag{WS}* { return TAG; } 66 ;{WS}*:{WS}*!{WS}* { return BANG; } 67 ^{WS}*:{WS}*!{WS}* { return BANG; } 68 69 70 :{WS}*avd { return AVD; } 71 :{WS}*mvds { return MVDS; } 72 :{WS}*rvds { return RVDS; } 73 :{WS}*ints { return INTS; } 74 :{WS}*fsds { return FSDS; } 75 :{WS}*root { return ROOT; } 76 77 :{WS}*attz { return ATTZ; } 78 :{WS}*atye { return ATYE; } 79 :{WS}*atmo { return ATMO; } 80 :{WS}*atda { return ATDA; } 81 :{WS}*atho { return ATHO; } 82 :{WS}*atmi { return ATMI; } 83 :{WS}*atse { return ATSE; } 84 :{WS}*atce { return ATCE; } 85 :{WS}*athu { return ATHU; } 86 :{WS}*atmic { return ATMIC; } 87 88 :{WS}*cttz { return CTTZ; } 89 :{WS}*ctye { return CTYE; } 90 :{WS}*ctmo { return CTMO; } 91 :{WS}*ctda { return CTDA; } 92 :{WS}*ctho { return CTHO; } 93 :{WS}*ctmi { return CTMI; } 94 :{WS}*ccte { return CTSE; } 95 :{WS}*ctce { return CTCE; } 96 :{WS}*cthu { return CTHU; } 97 :{WS}*ctmic { return CTMIC; } 98 99 :{WS}*mttz { return MTTZ; } 100 :{WS}*mtye { return MTYE; } 101 :{WS}*mtmo { return MTMO; } 102 :{WS}*mtda { return MTDA; } 103 :{WS}*mtho { return MTHO; } 104 :{WS}*mtmi { return MTMI; } 105 :{WS}*mtse { return MTSE; } 106 :{WS}*mtce { return MTCE; } 107 :{WS}*mthu { return MTHU; } 108 :{WS}*mtmic { return MTMIC; } 109 110 111 :{WS}*gid { return GID; } 112 :{WS}*ln { return LN; } 113 :{WS}*md { return MD; } 114 :{WS}*maj { return MAJ; } 115 :{WS}*min { return MIO; } 116 :{WS}*nm { return NM; } 117 :{WS}*sz { return SZ; } 118 :{WS}*uid { return UID; } 119 :{WS}*uniq { return UNIQ; } 120 121 122 [-0-9a-zA-Z._]+ { yylval.strval = yytext; return WORD; } 123 124 . { return yytext[0]; } 125 126 %% 127 128 void 129 yyerror() 130 { 131 fprintf(stderr, 132 gettext("Syntax error line : %d token : %s \n"), 133 cmd_no, yytext); 134 } 135 136 /* 137 :{WS}*fsds { return FSDS; } 138 :{WS}*root { return ROOT; } 139 */ 140