OSDN Git Service

removed all files
[xerial/xerial-core.git] / src / main / java / org / xerial / silk / schema / impl / SilkSchema.g
diff --git a/src/main/java/org/xerial/silk/schema/impl/SilkSchema.g b/src/main/java/org/xerial/silk/schema/impl/SilkSchema.g
deleted file mode 100755 (executable)
index d29b5ba..0000000
+++ /dev/null
@@ -1,283 +0,0 @@
-/*--------------------------------------------------------------------------\r
- *  Copyright 2009 Taro L. Saito\r
- *\r
- *  Licensed under the Apache License, Version 2.0 (the "License");\r
- *  you may not use this file except in compliance with the License.\r
- *  You may obtain a copy of the License at\r
- *\r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- *  Unless required by applicable law or agreed to in writing, software\r
- *  distributed under the License is distributed on an "AS IS" BASIS,\r
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- *  See the License for the specific language governing permissions and\r
- *  limitations under the License.\r
- *--------------------------------------------------------------------------*/\r
-//--------------------------------------\r
-// XerialJ\r
-//\r
-// SilkSchema.g\r
-// Since: Jun 23, 2009 1:00:02 PM\r
-//\r
-//--------------------------------------\r
\r
-grammar SilkSchema;\r
-options \r
-{\r
-  language=Java;\r
-  output=AST;\r
-}\r
-tokens {\r
-  Schema;\r
-  Module;\r
-  ClassDef;\r
-  Name;\r
-  Parent;\r
-  Mixin;\r
-  Attribute;\r
-  IsArray;\r
-  TypeName;\r
-  DefaultValue;\r
-  AllIncluded;\r
-  TargetClass;\r
-  Function;\r
-  Argument;\r
-}\r
-\r
-\r
-@lexer::header\r
-{\r
-/*--------------------------------------------------------------------------\r
- *  Copyright 2009 Taro L. Saito\r
- *\r
- *  Licensed under the Apache License, Version 2.0 (the "License");\r
- *  you may not use this file except in compliance with the License.\r
- *  You may obtain a copy of the License at\r
- *\r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- *  Unless required by applicable law or agreed to in writing, software\r
- *  distributed under the License is distributed on an "AS IS" BASIS,\r
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- *  See the License for the specific language governing permissions and\r
- *  limitations under the License.\r
- *--------------------------------------------------------------------------*/\r
-//--------------------------------------\r
-// XerialJ\r
-//\r
-// SilkSchemaLexer.java\r
-// Since: Jun 28, 2009 1:00:02 PM\r
-//\r
-//--------------------------------------\r
-\r
-package org.xerial.silk.schema.impl;\r
-\r
-}\r
-\r
\r
-@header\r
-{\r
-/*--------------------------------------------------------------------------\r
- *  Copyright 2009 Taro L. Saito\r
- *\r
- *  Licensed under the Apache License, Version 2.0 (the "License");\r
- *  you may not use this file except in compliance with the License.\r
- *  You may obtain a copy of the License at\r
- *\r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- *  Unless required by applicable law or agreed to in writing, software\r
- *  distributed under the License is distributed on an "AS IS" BASIS,\r
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- *  See the License for the specific language governing permissions and\r
- *  limitations under the License.\r
- *--------------------------------------------------------------------------*/\r
-//--------------------------------------\r
-// XerialJ\r
-//\r
-// SilkSchemaParser.java\r
-// Since: Jun 23, 2009 1:00:02 PM\r
-//\r
-//--------------------------------------\r
-package org.xerial.silk.schema.impl;\r
-}\r
-\r
-@lexer::members {\r
-  \r
-}\r
\r
-\r
-// lexer rules\r
-\r
-// preamble\r
-Preamble: { getCharPositionInLine() == 0 }? => '%' ~(LineBreakChar)*; \r
-\r
-// Line Comment\r
-fragment LineBreakChar: '\n' | '\r'; // r: <CR> n : <LF>\r
-LineComment: '#' ~(LineBreakChar)* { $channel = HIDDEN; };\r
-\r
-\r
-LineBreak: ('\r' '\n' | '\r' | '\n' ) { $channel = HIDDEN; }; \r
-\r
-\r
-fragment Digit: '0' .. '9';\r
-fragment Letter: 'A' .. 'F' | 'a' .. 'f';\r
-fragment HexDigit: Digit | Letter;\r
-fragment UnicodeChar: ~('"'| '\\');\r
-fragment EscapeSequence\r
-  : '\\' ('\"' | '\\' | '/' | 'b' | 'f' | 'n' | 'r' | 't' | 'u' HexDigit HexDigit HexDigit HexDigit)\r
-  ; \r
-\r
-fragment StringChar :  UnicodeChar | EscapeSequence;\r
-fragment StringChar_s: StringChar*;\r
-\r
-String: '"' s=StringChar_s '"' { setText($s.text); };\r
-\r
-\r
-Integer: '-'? ('0' | '1'..'9' Digit*);\r
-fragment Frac: '.' Digit+;\r
-fragment Exp: ('e' | 'E') ('+' | '-')? Digit+;\r
-Double: Integer (Frac Exp? | Exp);\r
-\r
-LBrace: '{' ;\r
-RBrace: '}' ;\r
-LBracket: '[' ;\r
-RBracket: ']' ;\r
-\r
-Lt: '<';\r
-Dot: '.';\r
-Comma: ',';\r
-\r
-LParen: '(';  \r
-RParen: ')';\r
-\r
-Star: '*';\r
-\r
-fragment\r
-UnsafeUnicodeChar: '(' | ')' | '[' | ']' | '{' | '}' | ',' | ':' | '#' | '<' | '>' | '|' | '*' | '\'' | '"' | '@' | '%' | '\\' | '.' | '-';    \r
-\r
-fragment\r
-NonWhiteSpaceChar: ~(UnsafeUnicodeChar | '\r' | '\n' | ' ' | '\t' | '\u000C');\r
-\r
-fragment SymbolChars: NonWhiteSpaceChar+;\r
-Symbol: (':' NonWhiteSpaceChar) =>  ':' s=SymbolChars { setText($s.text); };\r
-\r
-Class: 'class';\r
-Includes: 'includes';\r
-End: 'end';\r
-Relation: 'relation';\r
-Index: 'index';\r
-BelongsTo: 'belongs_to';\r
-Default: 'default';\r
-Projection: 'projection';\r
-OrderBy: 'order_by';\r
-On: 'on';\r
-\r
-fragment SafeFirstLetter: 'A' .. 'Z' | 'a' .. 'z';\r
-fragment SafeLetter: SafeFirstLetter | '0' .. '9' | '-' | '_';\r
-\r
-fragment ModuleName: SafeFirstLetter SafeLetter* ('.' SafeFirstLetter SafeLetter*)*; \r
-ModuleDef: 'module' WhiteSpaces s=ModuleName { setText($s.text); }; \r
-\r
-fragment QNameChar: ~(LineBreakChar | UnsafeUnicodeChar | WhiteSpace);\r
-QName: QNameChar+ (Dot QNameChar+)*;\r
-\r
-fragment \r
-WhiteSpace: ' ' | '\t';\r
\r
-WhiteSpaces: WhiteSpace+ { $channel = HIDDEN; }; \r
-\r
\r
-// parser rules \r
\r
-schema:  Preamble? schemaElement*  -> ^(Schema Preamble? schemaElement*) ;\r
-  \r
-\r
-schemaElement\r
-  : classDefinition \r
-  | projectionDef\r
-  | moduleDefinition\r
-  ;\r
-\r
-\r
-moduleDefinition:\r
-       ModuleDef schemaElement* End \r
-       -> ^(Module Name[$ModuleDef.text] schemaElement*)  \r
-       ;  \r
-  \r
-classDefinition\r
-  : Class QName inheritance? classBody? End -> ^(ClassDef Name[$QName.text] inheritance? classBody?)\r
-    | Relation QName inheritance? classBody? End -> ^(Relation Name[$QName.text] inheritance? classBody?)\r
-  ; \r
-  \r
-classBody: (belongsToStatement | includeStatement | attributes | indexStatement)+;\r
-\r
-\r
-projectionDef: Projection c=QName 'on' t=QName (projectColumn (Comma? projectColumn)*) orderByColumns? End \r
- -> ^(Projection Name[$c.text] TargetClass[$t.text] projectColumn+ orderByColumns?);\r
-\r
-fragment\r
-projectColumn\r
-  : QName  -> Attribute[$QName.text]\r
-  | Star -> AllIncluded["true"] \r
-  | Symbol -> Attribute[$Symbol.text]\r
-;\r
-\r
-fragment\r
-orderByColumns\r
-  : OrderBy orderByItem (Comma orderByItem)* -> orderByItem+\r
-;\r
-\r
-fragment\r
-orderByItem\r
-  : QName -> OrderBy[$QName.text] \r
-  | Symbol -> OrderBy[$Symbol.text]\r
-//  | QName LParen (functionArg (Comma functionArg)*)? RParen -> ^(Function Name[$QName.text] functionArg*) \r
-;\r
-\r
-fragment\r
-functionArg: Symbol -> Argument[$Symbol.text]\r
-;\r
-\r
-fragment \r
-belongsToStatement: BelongsTo QName -> BelongsTo[$QName.text]; \r
-  \r
-fragment \r
-inheritance: Lt QName -> Parent[$QName.text];\r
-  \r
-fragment \r
-includeStatement: Includes includeItem (Comma includeItem)* -> includeItem+;\r
-\r
-fragment \r
-includeItem: QName -> Mixin[$QName.text];\r
-\r
-fragment \r
-indexStatement: Index QName On indexTarget (Comma indexTarget)*\r
-  -> ^(Index TypeName[$QName.text] indexTarget+)\r
-; \r
-\r
-fragment \r
-indexTarget: Symbol -> Attribute[$Symbol.text]  \r
-; \r
-\r
-\r
-fragment \r
-attributes: attribute (Comma attribute)* \r
-  -> attribute+\r
-  ; \r
-       \r
-fragment \r
-attribute:\r
-  Symbol attributeType? (Default attributeValue)?  \r
-  -> ^(Attribute Name[$Symbol.text] attributeType? attributeValue?)  \r
-  ; \r
-\r
-attributeValue\r
-  : (String | Double | Integer) -> DefaultValue[$attributeValue.text]; \r
-  \r
-fragment attributeType\r
-  : QName -> TypeName[$QName.text] \r
-  | QName Star -> TypeName[$QName.text] IsArray["true"]\r
-  ;\r
-\r
-  
\ No newline at end of file