1: // Reference ETL Parser for Java
     2: // Copyright (c) 2000-2007 Constantine A Plotnikov
     3: //
     4: // Permission is hereby granted, free of charge, to any person 
     5: // obtaining a copy of this software and associated documentation 
     6: // files (the "Software"), to deal in the Software without restriction,
     7: // including without limitation the rights to use, copy, modify, merge, 
     8: // publish, distribute, sublicense, and/or sell copies of the Software, 
     9: // and to permit persons to whom the Software is furnished to do so, 
    10: // subject to the following conditions:
    11: //
    12: // The above copyright notice and this permission notice shall be 
    13: // included in all copies or substantial portions of the Software.
    14: // 
    15: // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
    16: // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
    17: // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
    18: // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
    19: // BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
    20: // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 
    21: // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
    22: // SOFTWARE. 
    23: doctype public "-//IDN etl.sf.net//ETL//Grammar 0.2.1";
    24: 
    25: /// This is a grammar for doctype declaration. The doctype can be encountered 
    26: /// as the first statement in the source code of ELT-based language. This 
    27: /// grammar is hard-coded in the parser for obvious reasons. So this file is 
    28: /// for information only.
    29: ///
    30: /// Note that this grammar does not support documentation comments. The mapping
    31: /// for these comments differs between different contexts and there is no 
    32: /// universal mapping that is suitable for all.
    33: ///
    34: /// <author>const</author>
    35: grammar net.sf.etl.grammars.DoctypeDeclaration {
    36: 	namespace dc = "http://etl.sf.net/etl/doctype/0.2.1";
    37: 	
    38: 	/// This is the only context in the grammar	
    39: 	context default DoctypeContext {
    40: 		
    41: 		/// A definition for string used in the grammar. Two kinds of string are allowed. 
    42: 		/// <example>
    43: 		///		'aaa'
    44: 		///		"aaa"
    45: 		/// </example>
    46: 		def String {
    47: 			string(quote="\"") | string(quote='\'');
    48: 		};
    49: 
    50: 		/// A doctype statement that declares grammar associated 
    51: 		/// with the file. The doctype statement is an obvious rip-off of XML doctype. 
    52: 		/// Inline grammar is not supported yet. 
    53: 		///
    54: 		/// System identifier or public identifier or both might be used. 
    55: 		/// <example>
    56: 		/// 	doctype public "-//IDN etl.sf.net/ETL/Grammar 0.2";
    57: 		/// 	doctype "http://etl.sf.net/2005/etl/grammar.g.etl" public '-//IDN etl.sf.net/ETL/Grammar 0.2';
    58: 		/// 	doctype 'mygrammar.g.etl';
    59: 		/// </example>
    60: 		statement DoctypeStatement {
    61: 			^ dc:DoctypeDeclaration {
    62: 				% doctype {
    63: 					{
    64: 						@ systemId = ref(String);
    65: 						% public {
    66: 							@ publicId = ref(String);
    67: 						}?;
    68: 					} | {
    69: 						% public {
    70: 							@ publicId = ref(String);
    71: 						};
    72: 					};
    73: 					% context {
    74: 						@ context = ref(String);
    75: 					}?;
    76: 				};
    77: 			};
    78: 		};
    79: 	};
    80: };