~ubuntu-branches/ubuntu/breezy/antlr/breezy

« back to all changes in this revision

Viewing changes to examples/python/multiLexer/javadoc_l.g

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2005-06-29 16:11:22 UTC
  • mfrom: (0.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050629161122-g81crc3z92p5xhsg
Tags: 2.7.5-6ubuntu4
Build depend on java-gcj-compat-dev, depend on java-gcj-compat.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// This file is part of PyANTLR. See LICENSE.txt for license
 
2
// details..........Copyright (C) Wolfgang Haefelinger, 2004.
 
3
//
 
4
// $Id$
 
5
 
 
6
options {
 
7
    language=Python;
 
8
}
 
9
 
 
10
class javadoc_l extends Lexer;
 
11
options {
 
12
        k=2;
 
13
        importVocab = Common;
 
14
        exportVocab = JavaDoc;
 
15
        filter=true;
 
16
}
 
17
 
 
18
PARAM
 
19
        :       "@param" ' ' ID
 
20
        ;
 
21
 
 
22
EXCEPTION
 
23
        :       "@exception" ' ' ID
 
24
        ;
 
25
 
 
26
protected
 
27
ID      :       ('a'..'z'|'A'..'Z')+
 
28
        ;
 
29
 
 
30
/** This rule simply prevents JAVADOC_CLOSE from being
 
31
 *  called for every '*' in a comment.  Calling JAVADOC_CLOSE
 
32
 *  will fail for simple '*' and cause an exception, which
 
33
 *  is slow.  In other words, the grammar will work without
 
34
 *  this rule, but is slower.
 
35
 */
 
36
STAR:   '*' {$setType(Token.SKIP);}
 
37
        ;
 
38
 
 
39
JAVADOC_CLOSE
 
40
        :       "*/" { import multilex; multilex.selector.pop();}
 
41
        ;
 
42
 
 
43
/** Ignore whitespace inside JavaDoc comments */
 
44
NEWLINE
 
45
        :       (       "\r\n"  // Evil DOS
 
46
                |       '\r'    // Macintosh
 
47
                |       '\n'    // Unix (the right way)
 
48
                )
 
49
                { self.newline(); $setType(Token.SKIP); }
 
50
        ;
 
51