Пример #1
0
 public void ExtractLayoutInfo(LayoutInformation info, ParseTreeNode parent )
 {
     foreach (var node in parent.ChildNodes)
     {
         if (node.Term == mLanguage.LayoutQualifierId)
         {
             var firstNode = node.ChildNodes [0];
             if (firstNode.Term == mLanguage.IDENTIFIER)
             {
                 var strValue = firstNode.Token.ValueString;
                 if (node.ChildNodes.Count == 1)
                 {
                     if (mLayouts.Contains (strValue))
                     {
                         info.Format = strValue;
                     }
                 }
                 else if (node.ChildNodes.Count == 3)
                 {
                     var thirdNode = node.ChildNodes [2];
                     if (node.ChildNodes [1].Token.ValueString == "=" &&
                         thirdNode.Term == mLanguage.ConstantExpression)
                     {
                         info.Location = (int) thirdNode.ChildNodes[0].Token.Value;
                     }
                 }
             }
         }
     }
 }
Пример #2
0
 private void ExtractLayout(LayoutInformation info, ParseTreeNode parent)
 {
     if (parent != null)
     {
         foreach (var child in parent.ChildNodes)
         {
             if (child.Term == mLanguage.LayoutQualifier)
             {
                 foreach (var node in child.ChildNodes)
                 {
                     if (node.Term == mLanguage.LayoutQualifierIdList)
                     {
                         ExtractLayoutInfo (info, node);
                     }
                 }
             }
         }
     }
 }