1
0
mirror of https://github.com/twiglet/cs2j.git synced 2025-01-18 13:15:17 +01:00

Template walker will recognize classes now. Need to pad out

This commit is contained in:
Kevin Glynn 2010-10-29 19:49:26 +02:00
parent 12d02666e3
commit 62170aa475
3 changed files with 1073 additions and 81 deletions

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,7 @@ options {
tokens {
QID;
TYPEBARE; TYPERS; TYPEADORNED; TYPEVOID;
}
@namespace { RusticiSoftware.Translator.CSharp }
@ -75,7 +76,7 @@ type_declaration:
// Identifiers
qualified_identifier:
i+=identifier ('.' i+=identifier)*
-> ^(QID $i+) ;
-> ^(QID identifier+) ;
namespace_name
: namespace_or_type_name ;
@ -334,13 +335,13 @@ qid_part:
generic_argument_list:
'<' type_arguments '>' ;
type_arguments:
type (',' type)* ;
type (',' type)* ;
type:
((predefined_type | type_name) rank_specifiers) => (predefined_type | type_name) rank_specifiers '*'*
| ((predefined_type | type_name) ('*'+ | '?')) => (predefined_type | type_name) ('*'+ | '?')
| (predefined_type | type_name)
| 'void' '*'+
((predefined_type | type_name) rank_specifiers) => (predefined_type | type_name) rank_specifiers '*'* -> ^(TYPERS predefined_type? type_name? rank_specifiers '*'*)
| ((predefined_type | type_name) ('*'+ | '?')) => (predefined_type | type_name) ('*'+ | '?') -> ^(TYPEADORNED predefined_type? type_name? '*'* '?'?)
| (predefined_type | type_name) -> ^(TYPEBARE predefined_type? type_name?)
| 'void' '*'+ -> ^(TYPEVOID '*'+)
;
non_nullable_type:
(predefined_type | type_name)
@ -1352,4 +1353,4 @@ primary_expression_list:
non_assignment_expression_list:
(non_assignment_expression ';')+ ;
method_declarations:
(modifiers? ('void' | type) method_declaration)+ ;
(modifiers? ('void' | type) method_declaration)+ ;

View File

@ -1,3 +1,5 @@
using RusticiSoftware.Translator.Utils;
using RusticiSoftware.Translator.CLR;
namespace RusticiSoftware.Translator.CSharp
{
using System;
@ -48,10 +50,10 @@ namespace RusticiSoftware.Translator.CSharp
AntlrUtils.AntlrUtils.DumpNodes(display_nodes);
BufferedTreeNodeStream nodes = new BufferedTreeNodeStream(parse_tree);
nodes.TokenStream = tokens;
TemplateExtracter templateWalker = new TemplateExtracter(nodes);
templateWalker.compilation_unit(new CS2JSettings());
templateWalker.compilation_unit(new CS2JSettings(), new DirectoryHT<TypeRepTemplate>());
}
}