Fixed: [Issue 88] Protobuf editor doesn't concatenate strings across
line breaks.
Also cleaned up the grammar.
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Labels.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Labels.java
index ae469a2..9fe9161 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Labels.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Labels.java
@@ -87,7 +87,7 @@
return text;
}
- private String messageName(MessageReference r) {
+ private String messageName(MessageRef r) {
return r.getType().getName();
}
}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/outline/ProtobufOutlineTreeProvider.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/outline/ProtobufOutlineTreeProvider.java
index 3b25837..7821e1c 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/outline/ProtobufOutlineTreeProvider.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/outline/ProtobufOutlineTreeProvider.java
@@ -30,7 +30,7 @@
static {
IGNORED_ELEMENT_TYPES.add(BooleanRef.class);
IGNORED_ELEMENT_TYPES.add(FieldOption.class);
- IGNORED_ELEMENT_TYPES.add(MessageReference.class);
+ IGNORED_ELEMENT_TYPES.add(MessageRef.class);
}
boolean _isLeaf(Option o) {
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext
index 81c3731..de2465b 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext
@@ -150,19 +150,40 @@
IntRef:
int=INT;
+
+terminal INT returns ecore::EInt: SIGNED_INT;
LongRef:
long=LONG;
+terminal LONG returns ecore::ELong: SIGNED_INT;
+
+terminal SIGNED_INT:
+ ('-')? (NUMBER)+;
+
FloatRef:
float=FLOAT;
+terminal FLOAT returns ecore::EFloat: DECIMAL;
+
DoubleRef:
double=DOUBLE;
+terminal DOUBLE returns ecore::EDouble: DECIMAL;
+
+terminal DECIMAL:
+ ('-')? (NUMBER)* ('.' (NUMBER)+)?
+;
+
StringRef:
string=STRING;
+terminal STRING:
+ SL_STRING (SL_STRING)*;
+
+terminal SL_STRING:
+ '"' ( '\\' ('b'|'t'|'n'|'f'|'r'|'u'|'"'|"'"|'\\') | !('\\'|'"') )* '"' (WS)*;
+
Nan:
number='nan';
@@ -177,8 +198,13 @@
Literal:
name=Name '=' index=(INT | HEX) ';';
+terminal HEX returns ecore::EInt: '0x'(NUMBER|'a'..'f'|'A'..'F')+;
+
+terminal NUMBER:
+ '0'..'9';
+
ExtendMessage:
- 'extend' message=MessageReference '{'
+ 'extend' message=MessageRef '{'
elements+=MessageElement*
'}'(';')?;
@@ -188,22 +214,16 @@
'}'(';')?;
Rpc:
- 'rpc' name=Name '(' argType=MessageReference ')' 'returns' '(' returnType=MessageReference ')'
+ 'rpc' name=Name '(' argType=MessageRef ')' 'returns' '(' returnType=MessageRef ')'
(('{' options+=Option* '}')(';')? | ';')
;
Name:
- ID | 'package' | 'import' | 'option' | 'extend' | 'message' | 'optional' | 'required' | 'repeated' | 'group' | 'enum'
- | 'service' | 'rpc' | 'returns' | 'true' | 'false' | 'default' | 'extensions' | 'to' | 'max' | 'double' | 'float'
- | 'int32' | 'int64' | 'uint32' | 'uint64' | 'sint32' | 'sint64' | 'fixed32' | 'fixed64' | 'sfixed32' | 'sfixed64' |
- 'bool' | 'string' | 'bytes';
+ ID | 'package' | 'import' | 'public' | 'option' | 'extend' | 'message' | 'optional' | 'required' | 'repeated' |
+ 'group' | 'enum' | 'service' | 'rpc' | 'returns' | 'true' | 'false' | 'default' | 'extensions' | 'to' | 'max' |
+ 'double' | 'float' | 'int32' | 'int64' | 'uint32' | 'uint64' | 'sint32' | 'sint64' | 'fixed32' | 'fixed64' |
+ 'sfixed32' | 'sfixed64' | 'bool' | 'string' | 'bytes';
-MessageReference:
+MessageRef:
type=[Message | QualifiedName];
-
-terminal HEX returns ecore::EInt: '0x'('0'..'9'|'a'..'f'|'A'..'F')+;
-terminal INT returns ecore::EInt: ('-')? ('0'..'9')+;
-terminal LONG returns ecore::ELong: ('-')? ('0'..'9')+;
-terminal FLOAT returns ecore::EFloat: ('-')? ('0'..'9')* ('.' ('0'..'9')+)?;
-terminal DOUBLE returns ecore::EDouble: ('-')? ('0'..'9')* ('.' ('0'..'9')+)?;
\ No newline at end of file
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider.java
index 4ca87be..d2f9d05 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ProtobufScopeProvider.java
@@ -69,7 +69,7 @@
}
@SuppressWarnings("unused")
- IScope scope_MessageReference_type(MessageReference msgRef, EReference reference) {
+ IScope scope_MessageReference_type(MessageRef msgRef, EReference reference) {
Protobuf root = finder.rootOf(msgRef);
Set<IEObjectDescription> descriptions = new HashSet<IEObjectDescription>();
descriptions.addAll(messagesIn(root));