More comments in the grammar
"used by" navigation
This commit is contained in:
@@ -16,6 +16,15 @@
|
|||||||
<SOURCES />
|
<SOURCES />
|
||||||
</library>
|
</library>
|
||||||
</orderEntry>
|
</orderEntry>
|
||||||
|
<orderEntry type="module-library">
|
||||||
|
<library>
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MODULE_DIR$/../../idea/idea.app/lib/guava-r09.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
h2. Classes
|
h2. Classes
|
||||||
|
|
||||||
|
*Relevant pages:* [Classes and Inheritance]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ memberDeclaration
|
|||||||
: function
|
: function
|
||||||
: property
|
: property
|
||||||
: class
|
: class
|
||||||
: extension §
|
: extension
|
||||||
: typedef
|
: typedef
|
||||||
: anonymousInitializer
|
: anonymousInitializer
|
||||||
;
|
;
|
||||||
|
|||||||
+32
-7
@@ -2,13 +2,6 @@
|
|||||||
h1. Lexical structure
|
h1. Lexical structure
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SimpleName
|
|
||||||
: <java identifier>;
|
|
||||||
FieldName
|
|
||||||
: "$" SimpleName;
|
|
||||||
LabelName
|
|
||||||
: "@" SimpleName;
|
|
||||||
|
|
||||||
[helper]
|
[helper]
|
||||||
Digit
|
Digit
|
||||||
: ["0".."9"];
|
: ["0".."9"];
|
||||||
@@ -29,15 +22,47 @@ HexadecimalLiteral
|
|||||||
CharacterLiteral
|
CharacterLiteral
|
||||||
: <character as in Java>;
|
: <character as in Java>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
bq. See [Basic types]
|
||||||
|
*/
|
||||||
|
|
||||||
StringWithTemplates
|
StringWithTemplates
|
||||||
: <single-quoted string, $ can be escaped>;
|
: <single-quoted string, $ can be escaped>;
|
||||||
|
|
||||||
NoEscapeString
|
NoEscapeString
|
||||||
: <"""-quoted string>;
|
: <"""-quoted string>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
bq. See [String templates]
|
||||||
|
*/
|
||||||
|
|
||||||
SEMI
|
SEMI
|
||||||
: <semicolon or newline>;
|
: <semicolon or newline>;
|
||||||
|
|
||||||
|
|
||||||
|
SimpleName
|
||||||
|
: <java identifier>
|
||||||
|
: "`" <java identifier> "`"
|
||||||
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
bq. See [Java interoperability]
|
||||||
|
*/
|
||||||
|
|
||||||
|
FieldName
|
||||||
|
: "$" SimpleName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
bq. See [Properties And Fields]
|
||||||
|
*/
|
||||||
|
|
||||||
|
LabelName
|
||||||
|
: "@" SimpleName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
bq. See [Nonlocal returns and jumps]
|
||||||
|
*/
|
||||||
|
|
||||||
/* Symbols:
|
/* Symbols:
|
||||||
|
|
||||||
[](){}<>
|
[](){}<>
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ modifier
|
|||||||
: memberModifier
|
: memberModifier
|
||||||
: parameterKind
|
: parameterKind
|
||||||
: attributes
|
: attributes
|
||||||
// sealed by default
|
|
||||||
;
|
;
|
||||||
|
|
||||||
classModifier
|
classModifier
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
package org.jetbrains.jet.grammar;
|
package org.jetbrains.jet.grammar;
|
||||||
|
|
||||||
|
import com.google.common.base.Supplier;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import com.google.common.collect.Multimap;
|
||||||
|
import com.google.common.collect.Multimaps;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.datatransfer.Clipboard;
|
import java.awt.datatransfer.Clipboard;
|
||||||
import java.awt.datatransfer.ClipboardOwner;
|
import java.awt.datatransfer.ClipboardOwner;
|
||||||
@@ -88,7 +94,14 @@ public class ConfluenceHyperlinksGenerator {
|
|||||||
|
|
||||||
Set<String> declaredSymbols = new HashSet<String>();
|
Set<String> declaredSymbols = new HashSet<String>();
|
||||||
Set<String> usedSymbols = new HashSet<String>();
|
Set<String> usedSymbols = new HashSet<String>();
|
||||||
|
Multimap<String, String> usages = Multimaps.newListMultimap(Maps.<String, Collection<String>>newHashMap(), new Supplier<List<String>>() {
|
||||||
|
@Override
|
||||||
|
public List<String> get() {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
});
|
||||||
List<Token> tokens = new ArrayList<Token>();
|
List<Token> tokens = new ArrayList<Token>();
|
||||||
|
Declaration lastDeclaration = null;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
Token advance = grammarLexer.advance();
|
Token advance = grammarLexer.advance();
|
||||||
@@ -97,10 +110,13 @@ public class ConfluenceHyperlinksGenerator {
|
|||||||
}
|
}
|
||||||
if (advance instanceof Declaration) {
|
if (advance instanceof Declaration) {
|
||||||
Declaration declaration = (Declaration) advance;
|
Declaration declaration = (Declaration) advance;
|
||||||
|
lastDeclaration = declaration;
|
||||||
declaredSymbols.add(declaration.getName());
|
declaredSymbols.add(declaration.getName());
|
||||||
}
|
}
|
||||||
else if (advance instanceof Identifier) {
|
else if (advance instanceof Identifier) {
|
||||||
Identifier identifier = (Identifier) advance;
|
Identifier identifier = (Identifier) advance;
|
||||||
|
assert lastDeclaration != null;
|
||||||
|
usages.put(identifier.getName(), lastDeclaration.getName());
|
||||||
usedSymbols.add(identifier.getName());
|
usedSymbols.add(identifier.getName());
|
||||||
}
|
}
|
||||||
tokens.add(advance);
|
tokens.add(advance);
|
||||||
@@ -109,10 +125,25 @@ public class ConfluenceHyperlinksGenerator {
|
|||||||
for (Token token : tokens) {
|
for (Token token : tokens) {
|
||||||
if (token instanceof Declaration) {
|
if (token instanceof Declaration) {
|
||||||
Declaration declaration = (Declaration) token;
|
Declaration declaration = (Declaration) token;
|
||||||
|
result.append("{anchor:").append(declaration.getName()).append("}");
|
||||||
if (!usedSymbols.contains(declaration.getName())) {
|
if (!usedSymbols.contains(declaration.getName())) {
|
||||||
// result.append("(!) *Unused!* ");
|
// result.append("(!) *Unused!* ");
|
||||||
System.out.println("Unused: " + token);
|
System.out.println("Unused: " + token);
|
||||||
}
|
}
|
||||||
|
Collection<String> myUsages = usages.get(declaration.getName());
|
||||||
|
if (!myUsages.isEmpty()) {
|
||||||
|
result.append("\\[{color:grey}Used by ");
|
||||||
|
for (Iterator<String> iterator = myUsages.iterator(); iterator.hasNext(); ) {
|
||||||
|
String usage = iterator.next();
|
||||||
|
result.append("[#").append(usage).append("]");
|
||||||
|
if (iterator.hasNext()) {
|
||||||
|
result.append(", ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.append("{color}\\]\n");
|
||||||
|
}
|
||||||
|
result.append(token);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
else if (token instanceof Identifier) {
|
else if (token instanceof Identifier) {
|
||||||
Identifier identifier = (Identifier) token;
|
Identifier identifier = (Identifier) token;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class Declaration extends Token {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "{anchor:" + name + "}*" + name + "*";
|
return "*" + name + "*";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
h1. Syntax
|
h1. Syntax
|
||||||
|
|
||||||
|
*Relevant pages:* [Namespaces]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
h4. Pattern matching
|
h4. Pattern matching
|
||||||
|
|
||||||
|
*Relevant pages:* [Pattern matching]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
when
|
when
|
||||||
|
|||||||
Reference in New Issue
Block a user