system/src/sc/parser/Parselet.java
public void updateCachedResult(Object res) {
      if (res instanceof IParseNode) {
         IParseNode resNode = (IParseNode) res;
         Object resVal = resNode.getSemanticValue();
         if (resVal instanceof ISemanticNode) {
            ISemanticNode resSN = (ISemanticNode) resVal;
            // If we were the original parselet to produce the cached result, need to update it.  Otherwise, we might be
            // caching up higher on the parselet hierarchy - i.e. where we are using a parent node in a different context.  In this
            // case, it's the child node's parselet which still produces the node (TODO: is this always true?)
            if (resNode.getParselet() == this)
               resSN.setParseNode(null); // Need to set it to null first, so this acts like a new parselet updating this for the first time (i.e. to update the parseletId)
            resSN.setParseNode(resNode);
         }
         ((IParseNode) res).setErrorNode(false);
      }
   }
/**
    * This is called when we are parsing using the result cache.  This node found a match in the cache, but the semantic value's parse-node
    * from the cached value might not be right - e.g. we parsed an expression as part of a methodPrefix, then did not find the :: and so stashed
    * the result, but where the semantic value has been updated to point to the methodPrefix.2 - we need to reset it back to the parse-node which
    * we are returning - probably lower down on the chain.
    */
This is called when we are parsing using the result cache.  This node found a match in the cache, but the semantic value's parse-node
from the cached value might not be right - e.g. we parsed an expression as part of a methodPrefix, then did not find the :: and so stashed
the result, but where the semantic value has been updated to point to the methodPrefix.2 - we need to reset it back to the parse-node which
we are returning - probably lower down on the chain.
This is called when we are parsing using the result cache . This node found a match in the cache but the semantic value ' s parse - node from the cached value might not be right - e . g . we parsed an expression as part of a methodPrefix then did not find the :: and so stashed the result but where the semantic value has been updated to point to the methodPrefix . 2 - we need to reset it back to the parse - node which we are returning - probably lower down on the chain .
public void updateCachedResult(Object res) {
      if (res instanceof IParseNode) {
         IParseNode resNode = (IParseNode) res;
         Object resVal = resNode.getSemanticValue();
         if (resVal instanceof ISemanticNode) {
            ISemanticNode resSN = (ISemanticNode) resVal;
            if (resNode.getParselet() == this)
               resSN.setParseNode(null); 
            resSN.setParseNode(resNode);
         }
         ((IParseNode) res).setErrorNode(false);
      }
   }
public void updateCachedResult ( Object res ) { if ( res instanceof IParseNode ) { IParseNode resNode = ( IParseNode ) res ; Object resVal = resNode . getSemanticValue ( ) ; if ( resVal instanceof ISemanticNode ) { ISemanticNode resSN = ( ISemanticNode ) resVal ; if ( resNode . getParselet ( ) == this ) resSN . setParseNode ( null ) ; resSN . setParseNode ( resNode ) ; } ( ( IParseNode ) res ) . setErrorNode ( false ) ; } }
This is called when we are parsing using the result cache.
This is called when we are parsing using the result cache .
// If we were the original parselet to produce the cached result, need to update it.  Otherwise, we might be // caching up higher on the parselet hierarchy - i.e. where we are using a parent node in a different context.  In this // case, it's the child node's parselet which still produces the node (TODO: is this always true?) // Need to set it to null first, so this acts like a new parselet updating this for the first time (i.e. to update the parseletId)