Пример #1
0
        private static Vt GetConstString(SyntaxTree syntaxTree)
        {
            ConstString result = null;

            if (syntaxTree.NodeType.Type == ContextfreeGrammarTreeNodeType.constStringLeave__)
            {
                string originalName = syntaxTree.NodeType.Content;
                originalName = originalName.Substring(1, originalName.Length - 2);
                string identifieredName = ConstString2IdentifierHelper.ConstString2Identifier(originalName);
                result = new ConstString(originalName, identifieredName);
            }

            return(result);
        }
Пример #2
0
        private static string GetLexicalAnalyzerName(string grammarId)
        {
            SourceCodeCharType charType = grammarId[0].GetCharType();

            if (charType == SourceCodeCharType.Letter || charType == SourceCodeCharType.UnderLine)
            {
                return(string.Format("{0}LexicalAnalyzer",
                                     ConstString2IdentifierHelper.ConstString2Identifier(grammarId)));
            }
            else
            {
                return(string.Format("_{0}LexicalAnalyzer",
                                     ConstString2IdentifierHelper.ConstString2Identifier(grammarId)));
            }
        }
Пример #3
0
        private static string GetTreeNodeConstTypeName(string grammarId, SyntaxParserMapAlgorithm algorithm)
        {
            SourceCodeCharType charType = grammarId[0].GetCharType();

            if (charType == SourceCodeCharType.Letter || charType == SourceCodeCharType.UnderLine)
            {
                return(string.Format("{0}{1}TreeNodeType",
                                     ConstString2IdentifierHelper.ConstString2Identifier(grammarId),
                                     algorithm));
            }
            else
            {
                return(string.Format("_{0}{1}TreeNodeType",
                                     ConstString2IdentifierHelper.ConstString2Identifier(grammarId),
                                     algorithm));
            }
        }
Пример #4
0
 protected override string GetTokenName()
 {
     return(ConstString2IdentifierHelper.ConstString2Identifier("/"));
 }