Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from makasprzak/proto-3
Proto 3
- Loading branch information
Showing
8 changed files
with
100 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/protobuf/lang/parser/parsing/Proto3FieldDeclaration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package protobuf.lang.parser.parsing; | ||
|
||
import com.intellij.lang.PsiBuilder; | ||
import protobuf.lang.parser.util.PbPatchedPsiBuilder; | ||
|
||
import static protobuf.lang.PbElementTypes.*; | ||
|
||
/** | ||
* @author Nikolay Matveev | ||
* Date: Mar 25, 2010 | ||
*/ | ||
public class Proto3FieldDeclaration { | ||
|
||
public static boolean parse(PbPatchedPsiBuilder builder) { | ||
if (builder.lookAhead(PROTO3_FIELD_LABELS, GROUP_SET) || builder.lookAhead(GROUP_SET)) { | ||
PsiBuilder.Marker messageMarker = builder.mark(); | ||
builder.match(PROTO3_FIELD_LABELS); | ||
builder.match(GROUP); | ||
builder.match(IK, "identifier.expected"); | ||
//builder.matchAs(IK, NAME, "identifier.expected"); | ||
builder.match(EQUAL, "equal.expected"); | ||
builder.matchAs(NUM_INT, VALUE, "num.integer.expected"); | ||
OptionDeclaration.parseOptionList(builder); | ||
if (!MessageDeclaration.parseMessageBlock(builder, true)) { | ||
builder.error("group.block.expected"); | ||
} | ||
messageMarker.done(GROUP_DECL); | ||
|
||
} else { | ||
PsiBuilder.Marker messageMarker = builder.mark(); | ||
builder.match(PROTO3_FIELD_LABELS); | ||
parseType(builder); | ||
builder.match(IK, "identifier.expected"); | ||
//builder.matchAs(IK, NAME, "identifier.expected"); | ||
builder.match(EQUAL, "equal.expected"); | ||
builder.matchAs(NUM_INT, VALUE, "num.integer.expected"); | ||
OptionDeclaration.parseOptionList(builder); | ||
builder.match(SEMICOLON, "semicolon.expected"); | ||
messageMarker.done(FIELD_DECL); | ||
} | ||
return true; | ||
} | ||
|
||
//done | ||
public static boolean parseType(PbPatchedPsiBuilder builder) { | ||
PsiBuilder.Marker marker = builder.mark(); | ||
if (builder.match(BUILT_IN_TYPES)) { | ||
} else if (ReferenceElement.parseForCustomType(builder)) { | ||
} else { | ||
marker.drop(); | ||
return false; | ||
} | ||
marker.done(FIELD_TYPE); | ||
return true; | ||
} | ||
|
||
//done | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4f799e8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it released? I've downloaded this plugin from a repository and it looks like it still doesn't work with 3.0.0 properly.
4f799e8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.