⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 existing.at

📁 GNU的词法/语法分析器bison源码
💻 AT
📖 第 1 页 / 共 5 页
字号:
		{		  $$ = $1;		  $$->flags |= IS_DASHED;		  lookup_variable("dashwid", & $$->dash_width);		}	| object_spec DASHED expr		{		  $$ = $1;		  $$->flags |= IS_DASHED;		  $$->dash_width = $3;		}	| object_spec FILL		{		  $$ = $1;		  $$->flags |= IS_DEFAULT_FILLED;		}	| object_spec FILL expr		{		  $$ = $1;		  $$->flags |= IS_FILLED;		  $$->fill = $3;		}	| object_spec SHADED text		{		  $$ = $1;		  $$->flags |= (IS_SHADED | IS_FILLED);		  $$->shaded = new char[strlen($3.str)+1];		  strcpy($$->shaded, $3.str);		}	| object_spec COLORED text		{		  $$ = $1;		  $$->flags |= (IS_SHADED | IS_OUTLINED | IS_FILLED);		  $$->shaded = new char[strlen($3.str)+1];		  strcpy($$->shaded, $3.str);		  $$->outlined = new char[strlen($3.str)+1];		  strcpy($$->outlined, $3.str);		}	| object_spec OUTLINED text		{		  $$ = $1;		  $$->flags |= IS_OUTLINED;		  $$->outlined = new char[strlen($3.str)+1];		  strcpy($$->outlined, $3.str);		}	| object_spec CHOP		{		  $$ = $1;		  // line chop chop means line chop 0 chop 0		  if ($$->flags & IS_DEFAULT_CHOPPED) {		    $$->flags |= IS_CHOPPED;		    $$->flags &= ~IS_DEFAULT_CHOPPED;		    $$->start_chop = $$->end_chop = 0.0;		  }		  else if ($$->flags & IS_CHOPPED) {		    $$->end_chop = 0.0;		  }		  else {		    $$->flags |= IS_DEFAULT_CHOPPED;		  }		}	| object_spec CHOP expr		{		  $$ = $1;		  if ($$->flags & IS_DEFAULT_CHOPPED) {		    $$->flags |= IS_CHOPPED;		    $$->flags &= ~IS_DEFAULT_CHOPPED;		    $$->start_chop = 0.0;		    $$->end_chop = $3;		  }		  else if ($$->flags & IS_CHOPPED) {		    $$->end_chop = $3;		  }		  else {		    $$->start_chop = $$->end_chop = $3;		    $$->flags |= IS_CHOPPED;		  }		}	| object_spec SAME		{		  $$ = $1;		  $$->flags |= IS_SAME;		}	| object_spec INVISIBLE		{		  $$ = $1;		  $$->flags |= IS_INVISIBLE;		}	| object_spec LEFT_ARROW_HEAD		{		  $$ = $1;		  $$->flags |= HAS_LEFT_ARROW_HEAD;		}	| object_spec RIGHT_ARROW_HEAD		{		  $$ = $1;		  $$->flags |= HAS_RIGHT_ARROW_HEAD;		}	| object_spec DOUBLE_ARROW_HEAD		{		  $$ = $1;		  $$->flags |= (HAS_LEFT_ARROW_HEAD|HAS_RIGHT_ARROW_HEAD);		}	| object_spec CW		{		  $$ = $1;		  $$->flags |= IS_CLOCKWISE;		}	| object_spec CCW		{		  $$ = $1;		  $$->flags &= ~IS_CLOCKWISE;		}	| object_spec text					%prec TEXT		{		  $$ = $1;		  text_item **p;		  for (p = & $$->text; *p; p = &(*p)->next)		    ;		  *p = new text_item($2.str, $2.filename, $2.lineno);		}	| object_spec LJUST		{		  $$ = $1;		  if ($$->text) {		    text_item *p;		    for (p = $$->text; p->next; p = p->next)		      ;		    p->adj.h = LEFT_ADJUST;		  }		}	| object_spec RJUST		{		  $$ = $1;		  if ($$->text) {		    text_item *p;		    for (p = $$->text; p->next; p = p->next)		      ;		    p->adj.h = RIGHT_ADJUST;		  }		}	| object_spec ABOVE		{		  $$ = $1;		  if ($$->text) {		    text_item *p;		    for (p = $$->text; p->next; p = p->next)		      ;		    p->adj.v = ABOVE_ADJUST;		  }		}	| object_spec BELOW		{		  $$ = $1;		  if ($$->text) {		    text_item *p;		    for (p = $$->text; p->next; p = p->next)		      ;		    p->adj.v = BELOW_ADJUST;		  }		}	| object_spec THICKNESS expr		{		  $$ = $1;		  $$->flags |= HAS_THICKNESS;		  $$->thickness = $3;		}	| object_spec ALIGNED		{		  $$ = $1;		  $$->flags |= IS_ALIGNED;		}	;text:	TEXT		{ $$ = $1; }	| SPRINTF '(' TEXT sprintf_args ')'		{		  $$.filename = $3.filename;		  $$.lineno = $3.lineno;		  $$.str = do_sprintf($3.str, $4.v, $4.nv);		  a_delete $4.v;		  a_delete $3.str;		}	;sprintf_args:	/* empty */		{		  $$.v = 0;		  $$.nv = 0;		  $$.maxv = 0;		}	| sprintf_args ',' expr		{		  $$ = $1;		  if ($$.nv >= $$.maxv) {		    if ($$.nv == 0) {		      $$.v = new double[4];		      $$.maxv = 4;		    }		    else {		      double *oldv = $$.v;		      $$.maxv *= 2;		      $$.v = new double[$$.maxv];		      memcpy($$.v, oldv, $$.nv*sizeof(double));		      a_delete oldv;		    }		  }		  $$.v[$$.nv] = $3;		  $$.nv += 1;		}	;position:	position_not_place		{ $$ = $1; }	| place		{		  position pos = $1;		  $$.x = pos.x;		  $$.y = pos.y;		}	;position_not_place:	expr_pair		{ $$ = $1; }	| position '+' expr_pair		{		  $$.x = $1.x + $3.x;		  $$.y = $1.y + $3.y;		}	| position '-' expr_pair		{		  $$.x = $1.x - $3.x;		  $$.y = $1.y - $3.y;		}	| '(' position ',' position ')'		{		  $$.x = $2.x;		  $$.y = $4.y;		}	| expr between position AND position		{		  $$.x = (1.0 - $1)*$3.x + $1*$5.x;		  $$.y = (1.0 - $1)*$3.y + $1*$5.y;		}	| expr '<' position ',' position '>'		{		  $$.x = (1.0 - $1)*$3.x + $1*$5.x;		  $$.y = (1.0 - $1)*$3.y + $1*$5.y;		}	;between:	BETWEEN	| OF THE WAY BETWEEN	;expr_pair:	expr ',' expr		{		  $$.x = $1;		  $$.y = $3;		}	| '(' expr_pair ')'		{ $$ = $2; }	;place:	/* line at A left == line (at A) left */	label							%prec CHOP		{ $$ = $1; }	| label corner		{		  path pth($2);		  if (!pth.follow($1, & $$))		    YYABORT;		}	| corner label		{		  path pth($1);		  if (!pth.follow($2, & $$))		    YYABORT;		}	| corner OF label		{		  path pth($1);		  if (!pth.follow($3, & $$))		    YYABORT;		}	| HERE		{		  $$.x = current_position.x;		  $$.y = current_position.y;		  $$.obj = 0;		}	;label:	LABEL		{		  place *p = lookup_label($1);		  if (!p) {		    lex_error("there is no place `%1'", $1);		    YYABORT;		  }		  $$ = *p;		  a_delete $1;		}	| nth_primitive		{ $$.obj = $1; }	| label '.' LABEL		{		  path pth($3);		  if (!pth.follow($1, & $$))		    YYABORT;		}	;ordinal:	ORDINAL		{ $$ = $1; }	| '`' any_expr TH		{		  // XXX Check for overflow (and non-integers?).		  $$ = (int)$2;		}	;optional_ordinal_last:	LAST		{ $$ = 1; }	| ordinal LAST		{ $$ = $1; }	;nth_primitive:	ordinal object_type		{		  int count = 0;		  object *p;		  for (p = olist.head; p != 0; p = p->next)		    if (p->type() == $2 && ++count == $1) {		      $$ = p;		      break;		    }		  if (p == 0) {		    lex_error("there is no %1%2 %3", $1, ordinal_postfix($1),			      object_type_name($2));		    YYABORT;		  }		}	| optional_ordinal_last object_type		{		  int count = 0;		  object *p;		  for (p = olist.tail; p != 0; p = p->prev)		    if (p->type() == $2 && ++count == $1) {		      $$ = p;		      break;		    }		  if (p == 0) {		    lex_error("there is no %1%2 last %3", $1,			      ordinal_postfix($1), object_type_name($2));		    YYABORT;		  }		}	;object_type:	BOX		{ $$ = BOX_OBJECT; }	| CIRCLE		{ $$ = CIRCLE_OBJECT; }	| ELLIPSE		{ $$ = ELLIPSE_OBJECT; }	| ARC		{ $$ = ARC_OBJECT; }	| LINE		{ $$ = LINE_OBJECT; }	| ARROW		{ $$ = ARROW_OBJECT; }	| SPLINE		{ $$ = SPLINE_OBJECT; }	| '[' ']'		{ $$ = BLOCK_OBJECT; }	| TEXT		{ $$ = TEXT_OBJECT; }	;label_path:	'.' LABEL		{ $$ = new path($2); }	| label_path '.' LABEL		{		  $$ = $1;		  $$->append($3);		}	;relative_path:	corner							%prec CHOP		{ $$ = new path($1); }	/* give this a lower precedence than LEFT and RIGHT so that	   [A: box] with .A left == [A: box] with (.A left) */	| label_path						%prec TEXT		{ $$ = $1; }	| label_path corner		{		  $$ = $1;		  $$->append($2);		}	;path:	relative_path		{ $$ = $1; }	| '(' relative_path ',' relative_path ')'		{		  $$ = $2;		  $$->set_ypath($4);		}	/* The rest of these rules are a compatibility sop. */	| ORDINAL LAST object_type relative_path		{		  lex_warning("`%1%2 last %3' in `with' argument ignored",			      $1, ordinal_postfix($1), object_type_name($3));		  $$ = $4;		}	| LAST object_type relative_path		{		  lex_warning("`last %1' in `with' argument ignored",			      object_type_name($2));		  $$ = $3;		}	| ORDINAL object_type relative_path		{		  lex_warning("`%1%2 %3' in `with' argument ignored",			      $1, ordinal_postfix($1), object_type_name($2));		  $$ = $3;		}	| LABEL relative_path		{		  lex_warning("initial `%1' in `with' argument ignored", $1);		  a_delete $1;		  $$ = $2;		}	;corner:	DOT_N		{ $$ = &object::north; }	| DOT_E		{ $$ = &object::east; }	| DOT_W		{ $$ = &object::west; }	| DOT_S		{ $$ = &object::south; }	| DOT_NE		{ $$ = &object::north_east; }	| DOT_SE		{ $$ = &object:: south_east; }	| DOT_NW		{ $$ = &object::north_west; }	| DOT_SW		{ $$ = &object::south_west; }	| DOT_C		{ $$ = &object::center; }	| DOT_START		{ $$ = &object::start; }	| DOT_END		{ $$ = &object::end; }	| TOP		{ $$ = &object::north; }	| BOTTOM		{ $$ = &object::south; }	| LEFT		{ $$ = &object::west; }	| RIGHT		{ $$ = &object::east; }	| UPPER LEFT		{ $$ = &object::north_west; }	| LOWER LEFT		{ $$ = &object::south_west; }	| UPPER RIGHT		{ $$ = &object::north_east; }	| LOWER RIGHT		{ $$ = &object::south_east; }	| LEFT_CORNER		{ $$ = &object::west; }	| RIGHT_CORNER		{ $$ = &object::east; }	| UPPER LEFT_CORNER		{ $$ = &object::north_west; }	| LOWER LEFT_CORNER		{ $$ = &object::south_west; }	| UPPER RIGHT_CORNER		{ $$ = &object::north_east; }	| LOWER RIGHT_CORNER		{ $$ = &object::south_east; }	| NORTH		{ $$ = &object::north; }	| SOUTH		{ $$ = &object::south; }	| EAST		{ $$ = &object::east; }	| WEST		{ $$ = &object::west;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -