Package sc.lang.java

Class QuestionMarkExpression

    • Constructor Detail

      • QuestionMarkExpression

        public QuestionMarkExpression()
    • Method Detail

      • setInferredType

        public boolean setInferredType​(java.lang.Object type,
                                       boolean finalType)
        Description copied from class: Expression
        Called once for each parent-child expression relationship during the start process to propagate the parent's inferredType to the child as we walk up the expression tree so that, for example, we know the initial information in the parameter type so we can find the right method, so the method's parameter types further refine types of the args. The last time we call it, finalType is set to true. When an error occurs and the type becomes "unknown" - we call this with type = UnknownReferredType and finalType =true
        Overrides:
        setInferredType in class Expression
      • eval

        public java.lang.Object eval​(java.lang.Class expectedType,
                                     ExecutionContext ctx)
      • getTypeDeclaration

        public java.lang.Object getTypeDeclaration()
      • getBindingTypeName

        public java.lang.String getBindingTypeName()
        Description copied from class: Expression
        Subclasses override this to return the class name to use for the binding expression
        Overrides:
        getBindingTypeName in class Expression
      • evalBindingArgs

        public void evalBindingArgs​(java.util.List<java.lang.Object> bindArgs,
                                    boolean isStatic,
                                    java.lang.Class expectedType,
                                    ExecutionContext ctx)
        Overrides:
        evalBindingArgs in class Expression
      • suggestCompletions

        public int suggestCompletions​(java.lang.String prefix,
                                      java.lang.Object currentType,
                                      ExecutionContext ctx,
                                      java.lang.String command,
                                      int cursor,
                                      java.util.Set<java.lang.String> candidates,
                                      java.lang.Object continuation,
                                      int max)
        Description copied from class: JavaSemanticNode
        Used to create a list of suggestions to complete this node. Returns the character offset into the parse-tree (or command string if there's no parse tree) where the completion should start. Parameters: prefix is the starting sequence of chars in the identifier to complete. All candidates returned will start with the prefix if it's provided. currentType provides a context for the current type if the node is not embedded in a model - i.e. an identifier expression on its own but known to live in a specific type If ctx is not null, it's an execution context we can use to evaluate the "root value" - i.e. in a.b the value of the variable 'a' is evaluated and the returned instance can be used to suggest candidates. This is useful in live-programming situations. The command String parameter is used to determine the offset returned for where the completion starts for the case where the parseNode tree is not available.
        Overrides:
        suggestCompletions in class JavaSemanticNode
      • transformTemplate

        public int transformTemplate​(int ix,
                                     boolean statefulContext)
        Description copied from class: JavaSemanticNode
        A pass over the semantic node tree to convert template statements into layer cake statements.
        Overrides:
        transformTemplate in class JavaSemanticNode
      • applyPartialValue

        public boolean applyPartialValue​(java.lang.Object value)
        Description copied from class: JavaSemanticNode
        When Parser.enablePartialValues is set, and we do not complete parsing the input we'll have a set of errors which represent model fragments. In some cases, it would be nice to put the model together as well as possible for code hinting. This method can append fragments onto it... if so return true.
        Overrides:
        applyPartialValue in class JavaSemanticNode
      • addBreakpointNodes

        public void addBreakpointNodes​(java.util.List<ISrcStatement> res,
                                       ISrcStatement srcStatement)
        Description copied from interface: ISrcStatement
        Adds all of the generated statements to the resulting list, for the case where more than one fromStatement points to the same src statement. These are used to determine which statements in the generated code should cause a 'break' when the developer sets a breakpoint on this statement.
        Specified by:
        addBreakpointNodes in interface ISrcStatement
        Overrides:
        addBreakpointNodes in class Statement
      • producesHtml

        public boolean producesHtml()
        If either one says it's HTML omit the escape. TODO: should we rewrite the expression if one does and the other does not to move the escape so it wraps only the trueChoice or the falseChoice not both?
        Overrides:
        producesHtml in class Expression