summaryrefslogtreecommitdiff
path: root/fpcsrc/utils/sim_pasc/textlang.l
blob: bb22d5d3511ecd0e9f6b72210010dab95c4036cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
%{
/*	This file is part of the software similarity tester SIM.
	Written by Dick Grune, Vrije Universiteit, Amsterdam.
	$Id: textlang.l,v 1.3 2007/08/29 09:10:36 dick Exp $
*/

/*
	Text front end for the similarity tester.
*/

#include	"language.h"
#include	"token.h"
#include	"idf.h"
#include	"lex.h"
#include	"lang.h"

/* Language-dependent Code */

void
InitLanguage(void) {
}

/*ARGSUSED*/
int
MayBeStartOfRun(TOKEN tk) {
	/* any token is acceptable */
	return 1;
}

/*ARGSUSED*/
unsigned int
CheckRun(const TOKEN *str, unsigned int size) {
	/* any run is acceptable */
	return size;
}

%}

%option nounput
%option never-interactive

Layout		([ \t\r\f])

%%

[^ \t\n]+	{			/* a word */
		/*	a word is defined as anything not containing
			layout
		*/
		return_tk(idf_hashed(yytext));
	}

\n	{				/* count newlines */
		return_eol();
	}

{Layout}	{			/* ignore layout */
	}

%%

/* Language-INdependent Code */

void
yystart(void) {
	BEGIN INITIAL;
}

int
yywrap(void) {
	return 1;
}