Package org.openquark.cal.compiler.SourceModel

Examples of org.openquark.cal.compiler.SourceModel.Pattern


           
            ArgBindings.Matching matchingArgBindings = (ArgBindings.Matching)argBindings;
           
            for (int i = 0; i < matchingArgBindings.getNFieldPatterns(); i++) {
                FieldPattern fieldPattern = matchingArgBindings.getNthFieldPattern(i);
                Pattern pattern = fieldPattern.getPattern();
               
                if (pattern == null) {
                    // punning.
                   
                    // Textual field names become Vars of the same name.
                    // Ordinal field names become wildcards ("_").
                    FieldName fieldName = fieldPattern.getFieldName().getName();
                    if (fieldName instanceof FieldName.Textual) {
                        pattern = Pattern.Var.make(fieldName.getCalSourceForm());
                    }
                }
               
                if (pattern instanceof Pattern.Var) {
                    Pattern.Var patternVar = (Pattern.Var)pattern;
                    addRegularBinding(patternVar.getName(), patternVar);
                }
            }

        } else if (argBindings instanceof ArgBindings.Positional) {
           
            ArgBindings.Positional positionalArgBindings = (ArgBindings.Positional)argBindings;
           
            for (int i = 0; i < positionalArgBindings.getNPatterns(); i++) {
                Pattern pattern = positionalArgBindings.getNthPattern(i);
                if (pattern instanceof Pattern.Var) {
                    Pattern.Var patternVar = (Pattern.Var)pattern;
                    addRegularBinding(patternVar.getName(), patternVar);
                }
            }
View Full Code Here


    public R visit_Expr_Case_Alt_UnpackTuple(UnpackTuple tuple, Object arg) {

        enterScope();
       
        for(int i = 0; i < tuple.getNPatterns(); i++) {
            Pattern pattern = tuple.getNthPattern(i);
            if(pattern instanceof Pattern.Var) {
                Pattern.Var patternVar = (Pattern.Var)pattern;
                addRegularBinding(patternVar.getName(), patternVar);
            }
        }
View Full Code Here

                if (record.getBaseRecordPattern() != null) {
                    addCasePatternToBindings(bindings, record.getBaseRecordPattern(), caseAndLambdaBoundLocalFunctionIdentifierGenerator);
                }

                for (final FieldPattern fieldPattern : record.getFieldPatterns()) {
                    final Pattern pattern = fieldPattern.getPattern();

                    if (pattern != null) {
                        addCasePatternToBindings(bindings, pattern, caseAndLambdaBoundLocalFunctionIdentifierGenerator);

                    } else {
View Full Code Here

                if (argBindings instanceof ArgBindings.Matching) {
                    final BindingsMap<IdentifierInfo.Local> bindings = BindingsMap.make();

                    for (final FieldPattern fieldPattern : ((ArgBindings.Matching)argBindings).getFieldPatterns()) {
                        final Pattern pattern = fieldPattern.getPattern();

                        if (pattern != null) {
                            addCasePatternToBindings(bindings, pattern, caseAndLambdaBoundLocalFunctionIdentifierGenerator);

                        } else {
View Full Code Here

TOP

Related Classes of org.openquark.cal.compiler.SourceModel.Pattern

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.