1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * See LICENSE.txt included in this distribution for the specific 9 * language governing permissions and limitations under the License. 10 * 11 * When distributing Covered Code, include this CDDL HEADER in each 12 * file and include the License file at LICENSE.txt. 13 * If applicable, add the following below this CDDL HEADER, with the 14 * fields enclosed by brackets "[]" replaced with your own identifying 15 * information: Portions Copyright [yyyy] [name of copyright owner] 16 * 17 * CDDL HEADER END 18 */ 19 20 /* 21 * Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. 22 * Copyright (c) 2012, 2013 Constantine A. Murenin <C++@Cns.SU> 23 * Portions Copyright (c) 2017, Chris Fraire <cfraire@me.com>. 24 */ 25 26 package org.opengrok.indexer.analysis.uue; 27 28 import org.opengrok.indexer.analysis.JFlexSymbolMatcher; 29 import org.opengrok.indexer.analysis.EmphasisHint; 30 import org.opengrok.indexer.web.HtmlConsts; 31 %% 32 %public 33 %class UuencodeXref 34 %extends JFlexSymbolMatcher 35 %unicode 36 %int 37 %char 38 %include ../CommonLexer.lexh 39 %include ../CommonXref.lexh 40 41 %state MODE NAME UUE 42 43 %include ../Common.lexh 44 %include ../CommonURI.lexh 45 %include ../CommonPath.lexh 46 %% 47 <YYINITIAL> { 48 ^ ( "begin " | "begin-base64 " ) { 49 yybegin(MODE); 50 yypushback(1); 51 onNonSymbolMatched(yytext(), EmphasisHint.STRONG, yychar); 52 } 53 54 {BrowseableURI} { 55 onUriMatched(yytext(), yychar); 56 } 57 58 {FNameChar}+ "@" {FNameChar}+ "." {FNameChar}+ { 59 onEmailAddressMatched(yytext(), yychar); 60 } 61 62 {FNameChar}+ { onNonSymbolMatched(yytext(), yychar); } 63 64 {EOL} { onEndOfLineMatched(yytext(), yychar); } 65 66 {WhspChar} | 67 [^\n] { onNonSymbolMatched(yytext(), yychar); } 68 } 69 70 <MODE> { 71 [ ] { onNonSymbolMatched(yytext(), yychar); } 72 [^ \n]+ " " { 73 yybegin(NAME); 74 yypushback(1); 75 onNonSymbolMatched(yytext(), EmphasisHint.EM, yychar); 76 } 77 [^] { yybegin(YYINITIAL); yypushback(1); } 78 } 79 80 <NAME>{ 81 [ ] { onNonSymbolMatched(yytext(), yychar); } 82 [^ \n]+\n { 83 yybegin(UUE); 84 yypushback(1); 85 String t = yytext(); 86 onQueryTermMatched(t, yychar); 87 onDisjointSpanChanged(HtmlConsts.COMMENT_CLASS, yychar); 88 } 89 [^] { yybegin(YYINITIAL); yypushback(1); } 90 } 91 92 <UUE> { 93 ^ ( "end" | "====" ) \n { 94 yybegin(YYINITIAL); 95 yypushback(1); 96 onDisjointSpanChanged(null, yychar); 97 onNonSymbolMatched(yytext(), EmphasisHint.STRONG, yychar); 98 } 99 100 {EOL} {onEndOfLineMatched(yytext(), yychar); } 101 [^\n\r]+ { onNonSymbolMatched(yytext(), yychar); } 102 } 103