Skip to content

Commit

Permalink
Merge pull request #3 from clatisus/junjie--support-airbnb-type
Browse files Browse the repository at this point in the history
feat. support Airbnb type & annotation
  • Loading branch information
clatisus authored Dec 16, 2021
2 parents a3453eb + abaef07 commit 7da4937
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@

.gradle
build
bin

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions thrift/src/main/grammar/Thrift.bnf
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ Throws ::= 'throws' '(' fieldsWithBraceRecovery ')' {pin=1}

FieldType ::= BaseType | ContainerType | CustomType
BaseType ::= SimpleBaseType TypeAnnotations?
SimpleBaseType ::= 'bool' | 'byte' | 'i8' | 'i16' | 'i32' | 'i64' | 'double' | 'string' | 'binary' | 'slist'
SimpleBaseType ::= 'bool' | 'byte' | 'i8' | 'i16' | 'i32' | 'i64' | 'double' | 'string' | 'binary' | 'slist' | SimpleAirbnbType
SimpleAirbnbType::= 'date_time' | 'date' | 'json_object' | 'id'
ContainerType ::= SimpleContainerType TypeAnnotations?
private SimpleContainerType ::= MapType | SetType | ListType
MapType ::= 'map' CppType? GenericType {pin=1}
Expand All @@ -163,6 +164,6 @@ ListSeparator ::= ',' | ';'

TypeAnnotations ::= '(' TypeAnnotationList ')'
TypeAnnotationList ::= TypeAnnotation* {recoverWhile=braceRecovery}
TypeAnnotation ::= Identifier ('=' Literal ListSeparator?)?
TypeAnnotation ::= Identifier ('=' Literal)? ListSeparator?

private braceRecovery ::= !(')')
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import com.intellij.util.containers.ContainerUtil;

import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
* Created by fkorotkov.
Expand All @@ -20,7 +22,14 @@ public class ThriftUtils {
"javame", "json", "netstd", "nodejs", "nodets", "ocaml", "swift", "ts", "xml"
);

public static Set<String> getKeywords() {
return keywords;
}
private static final Set<String> keywordsWithAirbnb =
Stream.concat(
keywords.stream(),
ContainerUtil.immutableSet(
"date_time", "date", "json_object", "id").stream()
).collect(Collectors.toSet());

public static Set<String> getKeywords() {
return keywordsWithAirbnb;
}
}

0 comments on commit 7da4937

Please sign in to comment.