statement : DRAW expr COMMA expr COMMA expr
422769
def p_statement_draw3(p):
    
    p[0] = make_sentence('DRAW3',
                         make_typecast(TYPE.integer, p[2], p.lineno(3)),
                         make_typecast(TYPE.integer, p[4], p.lineno(5)),
                         make_typecast(TYPE.float_, p[6], p.lineno(5)))
615861
def p_expr_lbound_expr(p):
    
    entry = SYMBOL_TABLE.access_array(p[3], p.lineno(3))
    if entry is None:
        p[0] = None
        return

    entry.accessed = True
    num = make_typecast(TYPE.uinteger, p[5], p.lineno(6))

    if is_number(num):
        if num.value == 0:  # 0 => Number of dims
            p[0] = make_number(len(entry.bounds), p.lineno(3), TYPE.uinteger)
            return

        val = num.value - 1
        if val < 0 or val >= len(entry.bounds):
            syntax_error(p.lineno(6), "Dimension out of range")
            p[0] = None
            return

        if p[1] == 'LBOUND':
            p[0] = make_number(entry.bounds[val].lower, p.lineno(3), TYPE.uinteger)
        else:
            p[0] = make_number(entry.bounds[val].upper, p.lineno(3), TYPE.uinteger)
        return

    if p[1] == 'LBOUND':
        entry.lbound_used = True
    else:
        entry.ubound_used = True

    p[0] = make_builtin(p.lineno(1), p[1], [entry, num], type_=TYPE.uinteger)
110387
function print(str, indent, inline) {
        var lines = str.split('\n');

        for(var i=0; i<lines.length; i++) {
            if(lines[i]) {
                if((inline && i > 0) || !inline) {
                    for(var j=0; j<indent; j++) {
                        process.stdout.write(' ');
                    }
                }
            }

            if(i === lines.length-1) {
                process.stdout.write(lines[i]);
            }
            else {
                process.stdout.write(lines[i] + '\n');
            }
        }
    }
1033966
def p_Statement(p):
    '''
    
    '''
    if len(p) < 3:
        term = Terminator('')
    else:
        term = p[2]
    p[0] = Statement(p[1], term)
1302913
def assign(self, expr):
        """"""
        name = self.variable()
        self.statements.append(ast.Assign([ast.Name(name, ast.Store())], expr))
        return ast.Name(name, ast.Load())
294451
function evaluate(expr) {
            if (expr.substring(0, 2) === '==') {
                return 'write(JSON.stringify('+expr.substring(2).trim()+'));\n';
            } else if (expr.substring(0, 1) === '=') {
                return 'write('+expr.substring(1).trim()+');\n';
            } else if (expr.substring(0, 3) === '...') {
                expr = '//...\n'+expr.substring(3).trim()+'\n//.';
            }
            if (expr !== '') {
                return expr+'\n';
            }
            return '';
        }
254561
def p_statement_randomize_expr(p):
    
    p[0] = make_sentence('RANDOMIZE', make_typecast(TYPE.ulong, p[2], p.lineno(1)))
1314740
public void emit1Quoted(int width, Pointer _str, final int len) {
        byte[] bstr = _str.buffer;
        int str = _str.start;

        boolean do_indent = false;
        int mark = str;
        int start = str;
        int end = str;
        write(SINGLE_QUOTE, 1);
        while(mark < str + len) {
            if(do_indent) {
                emitIndent();
                do_indent = false;
            }
            switch(bstr[mark]) {
            case '\'':
                write(SINGLE_QUOTE, 1);
                break;
            case '\n':
                end = mark + 1;
                if(bstr[start] != ' ' && bstr[start] != '\n' && bstr[end] != '\n' && bstr[end] != ' ' ) {
                    write(TWO_NEWLINES, 2);
                } else {
                    write(NEWLINE, 1);
                }
                do_indent = true;
                start = mark + 1;
                break;
            case ' ':
                if(width > 0 && bstr[start] != ' ' && mark - end > width ) {
                    do_indent = true;
                    end = mark + 1;
                } else {
                    write(SPACE, 1);
                }
                break;
            default:
                write(_str.withStart(mark), 1);
                break;
            }


        }
        write(SINGLE_QUOTE, 1);
    }
1323292
function drawSelectionRange(cm,range$$1,output){var display=cm.display,doc=cm.doc;var fragment=document.createDocumentFragment();var padding=paddingH(cm.display),leftSide=padding.left;var rightSide=Math.max(display.sizerWidth,displayWidth(cm)-display.sizer.offsetLeft)-padding.right;var docLTR=doc.direction=="ltr";function add(left,top,width,bottom){if(top<0){top=0;}top=Math.round(top);bottom=Math.round(bottom);fragment.appendChild(elt("div",null,"CodeMirror-selected","position: absolute; left: "+left+"px;\n                             top: "+top+"px; width: "+(width==null?rightSide-left:width)+"px;\n                             height: "+(bottom-top)+"px"));}function drawForLine(line,fromArg,toArg){var lineObj=getLine(doc,line);var lineLen=lineObj.text.length;var start,end;function coords(ch,bias){return _charCoords(cm,Pos(line,ch),"div",lineObj,bias);}function wrapX(pos,dir,side){var extent=wrappedLineExtentChar(cm,lineObj,null,pos);var prop=dir=="ltr"==(side=="after")?"left":"right";var ch=side=="after"?extent.begin:extent.end-(/\s/.test(lineObj.text.charAt(extent.end-1))?2:1);return coords(ch,prop)[prop];}var order=getOrder(lineObj,doc.direction);iterateBidiSections(order,fromArg||0,toArg==null?lineLen:toArg,function(from,to,dir,i){var ltr=dir=="ltr";var fromPos=coords(from,ltr?"left":"right");var toPos=coords(to-1,ltr?"right":"left");var openStart=fromArg==null&&from==0,openEnd=toArg==null&&to==lineLen;var first=i==0,last=!order||i==order.length-1;if(toPos.top-fromPos.top<=3){// Single line
var openLeft=(docLTR?openStart:openEnd)&&first;var openRight=(docLTR?openEnd:openStart)&&last;var left=openLeft?leftSide:(ltr?fromPos:toPos).left;var right=openRight?rightSide:(ltr?toPos:fromPos).right;add(left,fromPos.top,right-left,fromPos.bottom);}else{// Multiple lines
var topLeft,topRight,botLeft,botRight;if(ltr){topLeft=docLTR&&openStart&&first?leftSide:fromPos.left;topRight=docLTR?rightSide:wrapX(from,dir,"before");botLeft=docLTR?leftSide:wrapX(to,dir,"after");botRight=docLTR&&openEnd&&last?rightSide:toPos.right;}else{topLeft=!docLTR?leftSide:wrapX(from,dir,"before");topRight=!docLTR&&openStart&&first?rightSide:fromPos.right;botLeft=!docLTR&&openEnd&&last?leftSide:toPos.left;botRight=!docLTR?rightSide:wrapX(to,dir,"after");}add(topLeft,fromPos.top,topRight-topLeft,fromPos.bottom);if(fromPos.bottom<toPos.top){add(leftSide,fromPos.bottom,null,toPos.top);}add(botLeft,toPos.top,botRight-botLeft,toPos.bottom);}if(!start||cmpCoords(fromPos,start)<0){start=fromPos;}if(cmpCoords(toPos,start)<0){start=toPos;}if(!end||cmpCoords(fromPos,end)<0){end=fromPos;}if(cmpCoords(toPos,end)<0){end=toPos;}});return{start:start,end:end};}var sFrom=range$$1.from(),sTo=range$$1.to();if(sFrom.line==sTo.line){drawForLine(sFrom.line,sFrom.ch,sTo.ch);}else{var fromLine=getLine(doc,sFrom.line),toLine=getLine(doc,sTo.line);var singleVLine=visualLine(fromLine)==visualLine(toLine);var leftEnd=drawForLine(sFrom.line,sFrom.ch,singleVLine?fromLine.text.length+1:null).end;var rightStart=drawForLine(sTo.line,singleVLine?0:null,sTo.ch).start;if(singleVLine){if(leftEnd.top<rightStart.top-2){add(leftEnd.right,leftEnd.top,null,leftEnd.bottom);add(leftSide,rightStart.top,rightStart.left,rightStart.bottom);}else{add(leftEnd.right,leftEnd.top,rightStart.left-leftEnd.right,leftEnd.bottom);}}if(leftEnd.bottom<rightStart.top){add(leftSide,leftEnd.bottom,null,rightStart.top);}}output.appendChild(fragment);}
456753
def draw(self, value, newline=True, flush=True):
        
        # This is essentially winch-handling without having
        #   to do winch-handling; cleanly redrawing on winch is difficult
        #   and out of the intended scope of this class; we *can*
        #   however, adjust the next draw to be proper by re-measuring
        #   the terminal since the code is mostly written dynamically
        #   and many attributes and dynamically calculated properties.
        self._measure_terminal()
        
        # To avoid zero division, set amount_complete to 100% if max_value has been stupidly set to 0
        amount_complete = 1.0 if self.max_value == 0 else value / self.max_value
        fill_amount = int(floor(amount_complete * self.max_width))
        empty_amount = self.max_width - fill_amount

        # e.g., '10/20' if 'fraction' or '50%' if 'percentage'
        amount_complete_str = (
            u"{}/{}".format(value, self.max_value)
            if self._num_rep == "fraction" else
            u"{}%".format(int(floor(amount_complete * 100)))
        )

        # Write title if supposed to be above
        if self._title_pos == "above":
            title_str = u"{}{}\n".format(
                " " * self._indent,
                self.title,
            )
            self._write(title_str, ignore_overflow=True)

        # Construct just the progress bar
        bar_str = u''.join([
            u(self.filled(self._filled_char * fill_amount)),
            u(self.empty(self._empty_char * empty_amount)),
        ])
        # Wrap with start and end character
        bar_str = u"{}{}{}".format(self.start_char, bar_str, self.end_char)
        # Add on title if supposed to be on left or right
        if self._title_pos == "left":
            bar_str = u"{} {}".format(self.title, bar_str)
        elif self._title_pos == "right":
            bar_str = u"{} {}".format(bar_str, self.title)
        # Add indent
        bar_str = u''.join([" " * self._indent, bar_str])
        # Add complete percentage or fraction
        bar_str = u"{} {}".format(bar_str, amount_complete_str)
        # Set back to normal after printing
        bar_str = u"{}{}".format(bar_str, self.term.normal)
        # Finally, write the completed bar_str
        self._write(bar_str, s_length=self.full_line_width)

        # Write title if supposed to be below
        if self._title_pos == "below":
            title_str = u"\n{}{}".format(
                " " * self._indent,
                self.title,
            )
            self._write(title_str, ignore_overflow=True)

        # Newline to wrap up
        if newline:
            self.cursor.newline()
        if flush:
            self.cursor.flush()
452826
def from_statement(cls, statement, filename='<expr>'):
    
    lines = textwrap.dedent(statement).split('\n')
    if lines and not lines[0]:  # Remove the initial empty line, which is an artifact of dedent.
      lines = lines[1:]

    blob = '\n'.join(lines).encode('utf-8')
    tree = cls._parse(blob, filename)
    return cls(blob=blob, tree=tree, root=None, filename=filename)
150709
function transExpr(expContent, toFunc) {
  var ret
  expContent = expContent.trim().replace(/\"/g, '\'')
  if (!textParser.isExpr(expContent)) {
    ret = expContent
  }
  else {
    ret = []
    var tokens = textParser.parseText(expContent)
    var isSingle = tokens.length === 1
    tokens.forEach(function (token) {
      if (token.tag) {
        var res = expParser.parseExpression(token.value)
        if (!isSingle) {
          res = '(' + res + ')'
        }
        ret.push(res)
      }
      else {
        ret.push('\'' + token.value + '\'')
      }
    })
    ret = ret.join(' + ')
    if (toFunc !== false) {
      ret = eval('(function () {return ' + ret + '})')
    }
  }
  return ret
}
738049
def p_statement_plot(p):
    
    p[0] = make_sentence('PLOT',
                         make_typecast(TYPE.ubyte, p[2], p.lineno(3)),
                         make_typecast(TYPE.ubyte, p[4], p.lineno(3)))
549628
function executeExpr_(expr,context){
	var value=null;
	if(typeof expr=='string'){
		if(context.params[expr]){
			value=context.params[expr];
		}else{
			value=expr;
		}
	}else if(typeof expr[0]=='string'){
		switch(expr[0]){
		case 'defined':
			for(var k=1;k<expr.length;k++){
				if(typeof expr[k]!='string'){
					console.log("error: invalid format in defined expression");
					return null;
				}else if(context.params[expr[k]]==null){
					return false;
				}else{
					//nothing to do
				}
			}
			value=true;
			break;
		case 'append':{
			if(expr.length<3){
				console.log("error: append expression needs 2 arguments or more");
				return null;
			}
			value='';
			var v;
			for(var k=1;k<expr.length;k++){
				if(!(v=executeExpr(expr[k],context))){
					return false;
				}
				value+=v;
			}
			break;}
		case '&&':
			if(expr.length<3){
				console.log("error: && expression needs 2 arguments or more");
				return null;
			}
			for(var k=1;k<expr.length;k++){
				if(!executeExpr(expr[k],context)){
					return false;
				}
			}
			value=true;
			break;
		case '||':
			if(expr.length<3){
				console.log("error: && expression needs 2 arguments or more");
				return null;
			}
			for(var k=1;k<expr.length;k++){
				if(executeExpr(expr[k],context)){
					return true;
				}
			}
			value=false;
			break;
		case '==':
			if(expr.length!=3){
				console.log("error: == expression needs 2 arguments");
				return null;
			}
			return (executeExpr(expr[1],context)==executeExpr(expr[2],context));
		case '!=':
			if(expr.length!=3){
				console.log("error: != expression needs 2 arguments");
				return null;
			}
			return (executeExpr(expr[1],context)!=executeExpr(expr[2],context));
		case '!':
			if(expr.length!=2){
				console.log("error: == expression needs only 1 argument");
				return null;
			}
			return !executeExpr(expr[1],context);
			break;
		default:
			break;
		}
	}else if(expr[0] instanceof Array){
		if(expr.length==1){
			value=executeExpr(expr[0], context);
		}else{
			console.log("error: () expression needs only 1 argument");
		}
	}else{
		console.log("error: unknown expression");
	}
	return value;
}
1127615
def p_postfix_expr(self, p):
        
        if len(p) == 2:
            p[0] = p[1]
        else:
            p[0] = self.asttypes.PostfixExpr(op=p[2], value=p[1])
            p[0].setpos(p, 2)
1357998
def p_statement_for(p):
    ''
    p[0] = ast.For(p[3], p[5], p[7], p[9], lineno=p.lineno(1))
640654
function ArrayExpression(node, print) {
  var elems = node.elements;
  var len = elems.length;

  this.push("[");
  print.printInnerComments();

  for (var i = 0; i < elems.length; i++) {
    var elem = elems[i];
    if (elem) {
      if (i > 0) this.space();
      print.plain(elem);
      if (i < len - 1) this.push(",");
    } else {
      // If the array expression ends with a hole, that hole
      // will be ignored by the interpreter, but if it ends with
      // two (or more) holes, we need to write out two (or more)
      // commas so that the resulting code is interpreted with
      // both (all) of the holes.
      this.push(",");
    }
  }

  this.push("]");
}