Skip to content

Commit 7b37633

Browse files
committed
Add classes to support Eiffel analysis
1 parent 0d47f77 commit 7b37633

19 files changed

+2987
-1
lines changed

Diff for: LICENSE-ecma.txt

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Standard ECMA-367
2+
2nd Edition - June 2006
3+
Eiffel: Analysis, Design and Programming Language
4+
5+
COPYRIGHT NOTICE
6+
© 2006 Ecma International
7+
8+
This document may be copied, published and distributed to others, and
9+
certain derivative works of it may be prepared, copied, published, and
10+
distributed, in whole or in part, provided that the above copyright notice
11+
and this Copyright License and Disclaimer are included on all such copies
12+
and derivative works. The only derivative works that are permissible under
13+
this Copyright License and Disclaimer are:
14+
15+
(i) works which incorporate all or portion of this document for the
16+
purpose of providing commentary or explanation (such as an annotated version
17+
of the document),
18+
(ii) works which incorporate all or portion of this document for the
19+
purpose of incorporating features that provide accessibility,
20+
(iii) translations of this document into languages other than English
21+
and into different formats and
22+
(iv) works by making use of this specification in standard conformant
23+
products by implementing (e.g. by copy and paste wholly or partly) the
24+
functionality therein.
25+
26+
However, the content of this document itself may not be modified in any way,
27+
including by removing the copyright notice or references to Ecma
28+
International, except as required to translate it into languages other than
29+
English or into a different format.
30+
31+
The official version of an Ecma International document is the English
32+
language version on the Ecma International website. In the event of
33+
discrepancies between a translated version and the official version, the
34+
official version shall govern.
35+
36+
The limited permissions granted above are perpetual and will not be revoked
37+
by Ecma International or its successors or assigns.
38+
39+
This document and the information contained herein is provided on an "AS IS"
40+
basis and ECMA INTERNATIONAL DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
41+
INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
42+
HEREIN WILL NOT INFRINGE ANY OWNERSHIP RIGHTS OR ANY IMPLIED WARRANTIES OF
43+
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

Diff for: build.xml

+2
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ Portions Copyright (c) 2017, Chris Fraire <[email protected]>.
286286
<run-jflex dir="${gen.analysis.dir}/c" name="CXref"/>
287287
<run-jflex dir="${gen.analysis.dir}/c" name="CxxSymbolTokenizer"/>
288288
<run-jflex dir="${gen.analysis.dir}/c" name="CxxXref"/>
289+
<run-jflex dir="${gen.analysis.dir}/eiffel" name="EiffelSymbolTokenizer"/>
290+
<run-jflex dir="${gen.analysis.dir}/eiffel" name="EiffelXref"/>
289291
<run-jflex dir="${gen.analysis.dir}/erlang" name="ErlangSymbolTokenizer"/>
290292
<run-jflex dir="${gen.analysis.dir}/erlang" name="ErlangXref"/>
291293
<run-jflex dir="${gen.analysis.dir}/fortran" name="FortranSymbolTokenizer"/>

Diff for: opengrok-indexer/pom.xml

+7
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ Portions Copyright (c) 2017, Chris Fraire <[email protected]>.
116116
<exclude>*.java</exclude>
117117
</excludes>
118118
</testResource>
119+
<testResource>
120+
<targetPath>org/opensolaris/opengrok/analysis/eiffel/</targetPath>
121+
<directory>../test/org/opensolaris/opengrok/analysis/eiffel/</directory>
122+
<excludes>
123+
<exclude>*.java</exclude>
124+
</excludes>
125+
</testResource>
119126
<testResource>
120127
<targetPath>org/opensolaris/opengrok/analysis/erlang/</targetPath>
121128
<directory>../test/org/opensolaris/opengrok/analysis/erlang/</directory>

Diff for: src/org/opensolaris/opengrok/analysis/AnalyzerGuru.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
import org.opensolaris.opengrok.analysis.data.ImageAnalyzerFactory;
6767
import org.opensolaris.opengrok.analysis.document.MandocAnalyzerFactory;
6868
import org.opensolaris.opengrok.analysis.document.TroffAnalyzerFactory;
69+
import org.opensolaris.opengrok.analysis.eiffel.EiffelAnalyzerFactory;
6970
import org.opensolaris.opengrok.analysis.erlang.ErlangAnalyzerFactory;
7071
import org.opensolaris.opengrok.analysis.executables.ELFAnalyzerFactory;
7172
import org.opensolaris.opengrok.analysis.executables.JarAnalyzerFactory;
@@ -251,7 +252,8 @@ public class AnalyzerGuru {
251252
new LuaAnalyzerFactory(),
252253
new PascalAnalyzerFactory(),
253254
new AdaAnalyzerFactory(),
254-
new RubyAnalyzerFactory()
255+
new RubyAnalyzerFactory(),
256+
new EiffelAnalyzerFactory()
255257
};
256258

257259
for (FileAnalyzerFactory analyzer : analyzers) {
+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
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) 2017, Chris Fraire <[email protected]>.
22+
*/
23+
24+
package org.opensolaris.opengrok.analysis.eiffel;
25+
26+
import java.util.HashSet;
27+
import java.util.Set;
28+
29+
/**
30+
* Represents a container for a set of Eiffel keywords.
31+
*/
32+
public class Consts {
33+
34+
public static final Set<String> kwd = new HashSet<String>();
35+
36+
static {
37+
/*
38+
* The following are defined with specific non-lower casing to
39+
* distinguish them as non-key words (e.g., "TUPLE"), but Eiffel is
40+
* case-insensitive per 8.2.19 Semantics: Case Insensitivity principle.
41+
* For OpenGrok Consts purposes, therefore, `kwd' is all lower-cased.
42+
*/
43+
kwd.add("current"); // 8.32.13 Definition: Reserved (non-key)word
44+
kwd.add("false"); // 8.32.13 Definition: Reserved (non-key)word
45+
kwd.add("precursor"); // 8.32.13 Definition: Reserved (non-key)word
46+
kwd.add("result"); // 8.32.13 Definition: Reserved (non-key)word
47+
kwd.add("tuple"); // 8.32.13 Definition: Reserved (non-key)word
48+
kwd.add("true"); // 8.32.13 Definition: Reserved (non-key)word
49+
kwd.add("void"); // 8.32.13 Definition: Reserved (non-key)word
50+
51+
kwd.add("agent"); // 8.32.13 Definition: Reserved keyword
52+
kwd.add("alias"); // 8.32.13 Definition: Reserved keyword
53+
kwd.add("all"); // 8.32.13 Definition: Reserved keyword
54+
kwd.add("and"); // 8.32.13 Definition: Reserved keyword
55+
kwd.add("as"); // 8.32.13 Definition: Reserved keyword
56+
kwd.add("assign"); // 8.32.13 Definition: Reserved keyword
57+
kwd.add("attribute"); // 8.32.13 Definition: Reserved keyword
58+
kwd.add("check"); // 8.32.13 Definition: Reserved keyword
59+
kwd.add("class"); // 8.32.13 Definition: Reserved keyword
60+
kwd.add("convert"); // 8.32.13 Definition: Reserved keyword
61+
kwd.add("create"); // 8.32.13 Definition: Reserved keyword
62+
kwd.add("debug"); // 8.32.13 Definition: Reserved keyword
63+
kwd.add("deferred"); // 8.32.13 Definition: Reserved keyword
64+
kwd.add("do"); // 8.32.13 Definition: Reserved keyword
65+
kwd.add("else"); // 8.32.13 Definition: Reserved keyword
66+
kwd.add("elseif"); // 8.32.13 Definition: Reserved keyword
67+
kwd.add("end"); // 8.32.13 Definition: Reserved keyword
68+
kwd.add("ensure"); // 8.32.13 Definition: Reserved keyword
69+
kwd.add("expanded"); // 8.32.13 Definition: Reserved keyword
70+
kwd.add("export"); // 8.32.13 Definition: Reserved keyword
71+
kwd.add("external"); // 8.32.13 Definition: Reserved keyword
72+
kwd.add("feature"); // 8.32.13 Definition: Reserved keyword
73+
kwd.add("from"); // 8.32.13 Definition: Reserved keyword
74+
kwd.add("frozen"); // 8.32.13 Definition: Reserved keyword
75+
kwd.add("if"); // 8.32.13 Definition: Reserved keyword
76+
kwd.add("implies"); // 8.32.13 Definition: Reserved keyword
77+
kwd.add("inherit"); // 8.32.13 Definition: Reserved keyword
78+
kwd.add("inspect"); // 8.32.13 Definition: Reserved keyword
79+
kwd.add("invariant"); // 8.32.13 Definition: Reserved keyword
80+
kwd.add("like"); // 8.32.13 Definition: Reserved keyword
81+
kwd.add("local"); // 8.32.13 Definition: Reserved keyword
82+
kwd.add("loop"); // 8.32.13 Definition: Reserved keyword
83+
kwd.add("not"); // 8.32.13 Definition: Reserved keyword
84+
kwd.add("note"); // 8.32.13 Definition: Reserved keyword
85+
kwd.add("obsolete"); // 8.32.13 Definition: Reserved keyword
86+
kwd.add("old"); // 8.32.13 Definition: Reserved keyword
87+
kwd.add("once"); // 8.32.13 Definition: Reserved keyword
88+
kwd.add("only"); // 8.32.13 Definition: Reserved keyword
89+
kwd.add("or"); // 8.32.13 Definition: Reserved keyword
90+
kwd.add("redefine"); // 8.32.13 Definition: Reserved keyword
91+
kwd.add("rename"); // 8.32.13 Definition: Reserved keyword
92+
kwd.add("require"); // 8.32.13 Definition: Reserved keyword
93+
kwd.add("rescue"); // 8.32.13 Definition: Reserved keyword
94+
kwd.add("retry"); // 8.32.13 Definition: Reserved keyword
95+
kwd.add("select"); // 8.32.13 Definition: Reserved keyword
96+
kwd.add("separate"); // 8.32.13 Definition: Reserved keyword
97+
kwd.add("then"); // 8.32.13 Definition: Reserved keyword
98+
kwd.add("undefine"); // 8.32.13 Definition: Reserved keyword
99+
kwd.add("until"); // 8.32.13 Definition: Reserved keyword
100+
kwd.add("variant"); // 8.32.13 Definition: Reserved keyword
101+
kwd.add("when"); // 8.32.13 Definition: Reserved keyword
102+
kwd.add("xor"); // 8.32.13 Definition: Reserved keyword
103+
}
104+
105+
/** private to enforce static */
106+
private Consts () {
107+
}
108+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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) 2017, Chris Fraire <[email protected]>.
22+
*/
23+
24+
package org.opensolaris.opengrok.analysis.eiffel;
25+
26+
import java.io.Reader;
27+
import org.opensolaris.opengrok.analysis.FileAnalyzer;
28+
import org.opensolaris.opengrok.analysis.FileAnalyzerFactory;
29+
import org.opensolaris.opengrok.analysis.JFlexXref;
30+
import org.opensolaris.opengrok.analysis.plain.AbstractSourceCodeAnalyzer;
31+
32+
/**
33+
* Represents an analyzer for the Eiffel language.
34+
*/
35+
public class EiffelAnalyzer extends AbstractSourceCodeAnalyzer {
36+
37+
/**
38+
* Creates a new instance of {@link EiffelAnalyzer}.
39+
* @param factory instance
40+
*/
41+
protected EiffelAnalyzer(FileAnalyzerFactory factory) {
42+
super(factory);
43+
SymbolTokenizer = new EiffelSymbolTokenizer(FileAnalyzer.dummyReader);
44+
}
45+
46+
/**
47+
* Creates a new {@link EiffelXref} instance.
48+
* @return a defined instance
49+
*/
50+
@Override
51+
protected JFlexXref newXref(Reader reader) {
52+
return new EiffelXref(reader);
53+
}
54+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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) 2017, Chris Fraire <[email protected]>.
22+
*/
23+
24+
package org.opensolaris.opengrok.analysis.eiffel;
25+
26+
import org.opensolaris.opengrok.analysis.FileAnalyzer;
27+
import org.opensolaris.opengrok.analysis.FileAnalyzer.Genre;
28+
import org.opensolaris.opengrok.analysis.FileAnalyzerFactory;
29+
30+
/**
31+
* Represents a factory to create {@link EiffelAnalyzer} instances.
32+
*/
33+
public class EiffelAnalyzerFactory extends FileAnalyzerFactory {
34+
35+
private static final String NAME = "Eiffel";
36+
37+
private static final String[] SUFFIXES = {"E"};
38+
39+
/**
40+
* Initializes a factory instance to associate a file extension ".e" with
41+
* {@link EiffelAnalyzer}.
42+
*/
43+
public EiffelAnalyzerFactory() {
44+
super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN,
45+
NAME);
46+
}
47+
48+
/**
49+
* Creates a new {@link EiffelAnalyzer} instance.
50+
* @return a defined instance
51+
*/
52+
@Override
53+
protected FileAnalyzer newAnalyzer() {
54+
return new EiffelAnalyzer(this);
55+
}
56+
}

0 commit comments

Comments
 (0)