stage1_2/iec_flex.ll
changeset 1010 242907849850
parent 952 e984cfdf3b10
child 1013 d41dc551a326
equal deleted inserted replaced
1004:c25446920923 1010:242907849850
  1099 .				BEGIN(ignore_pou_state); unput_text(0);
  1099 .				BEGIN(ignore_pou_state); unput_text(0);
  1100 }
  1100 }
  1101 
  1101 
  1102 <ignore_pou_state>{
  1102 <ignore_pou_state>{
  1103 END_FUNCTION			unput_text(0); BEGIN(INITIAL);
  1103 END_FUNCTION			unput_text(0); BEGIN(INITIAL);
  1104 END_FUNCTION_BLOCK		unput_text(0); BEGIN(INITIAL); 
  1104 END_FUNCTION_BLOCK		unput_text(0); BEGIN(INITIAL);
  1105 END_PROGRAM			unput_text(0); BEGIN(INITIAL); 
  1105 END_PROGRAM			unput_text(0); BEGIN(INITIAL);
  1106 END_CONFIGURATION		unput_text(0); BEGIN(INITIAL); 
  1106 END_CONFIGURATION		unput_text(0); BEGIN(INITIAL);
  1107 .|\n				{}/* Ignore text inside POU! (including the '\n' character!)) */
  1107 .|\n				{}/* Ignore text inside POU! (including the '\n' character!)) */
  1108 }
  1108 }
  1109 
  1109 
  1110 	/* INITIAL -> body_state */
  1110 	/* INITIAL -> body_state */
  1111 	/* required if the function, program, etc.. has no VAR block! */
  1111 	/* required if the function, program, etc.. has no VAR block! */
  1145 VAR_TEMP			|
  1145 VAR_TEMP			|
  1146 VAR_CONFIG			|
  1146 VAR_CONFIG			|
  1147 VAR_ACCESS			|
  1147 VAR_ACCESS			|
  1148 VAR				unput_text(0); yy_push_state(vardecl_state);
  1148 VAR				unput_text(0); yy_push_state(vardecl_state);
  1149 
  1149 
  1150 END_FUNCTION			unput_text(0); BEGIN(INITIAL); 
  1150 END_FUNCTION			unput_text(0); BEGIN(INITIAL);
  1151 END_FUNCTION_BLOCK		unput_text(0); BEGIN(INITIAL); 
  1151 END_FUNCTION_BLOCK		unput_text(0); BEGIN(INITIAL);
  1152 END_PROGRAM			unput_text(0); BEGIN(INITIAL); 
  1152 END_PROGRAM			unput_text(0); BEGIN(INITIAL);
  1153 
  1153 
  1154 .				unput_text(0); yy_push_state(body_state); /* anything else, just change to body_state! */
  1154 .				unput_text(0); yy_push_state(body_state); /* anything else, just change to body_state! */
  1155 }
  1155 }
  1156 
  1156 
  1157 
  1157 
  1478 
  1478 
  1479 
  1479 
  1480 	/***********************/
  1480 	/***********************/
  1481 	/* B 1.5.1 - Functions */
  1481 	/* B 1.5.1 - Functions */
  1482 	/***********************/
  1482 	/***********************/
  1483 FUNCTION	return FUNCTION;	/* Keyword */
  1483 	/* Note: The following END_FUNCTION rule includes a BEGIN(INITIAL); command.
  1484 END_FUNCTION	return END_FUNCTION;	/* Keyword */
  1484 	 *       This is necessary in case the input program being pased has syntax errors that force
  1485 VAR		return VAR;		/* Keyword */
  1485 	 *       flex's main state machine to never change to the il_state or the st_state
  1486 CONSTANT	return CONSTANT;	/* Keyword */
  1486 	 *       after changing to the body_state.
       
  1487 	 *       Ths BEGIN(INITIAL) command forces the flex state machine to re-synchronise with 
       
  1488 	 *       the input stream even in the presence of buggy code!
       
  1489 	 */
       
  1490 FUNCTION			return FUNCTION;			/* Keyword */
       
  1491 END_FUNCTION	BEGIN(INITIAL);	return END_FUNCTION;			/* Keyword */  /* see Note above */
       
  1492 VAR				return VAR;				/* Keyword */
       
  1493 CONSTANT			return CONSTANT;			/* Keyword */
  1487 
  1494 
  1488 
  1495 
  1489 	/*****************************/
  1496 	/*****************************/
  1490 	/* B 1.5.2 - Function Blocks */
  1497 	/* B 1.5.2 - Function Blocks */
  1491 	/*****************************/
  1498 	/*****************************/
  1492 FUNCTION_BLOCK		return FUNCTION_BLOCK;		/* Keyword */
  1499 	/* Note: The following END_FUNCTION_BLOCK rule includes a BEGIN(INITIAL); command.
  1493 END_FUNCTION_BLOCK	return END_FUNCTION_BLOCK;	/* Keyword */
  1500 	 *       This is necessary in case the input program being pased has syntax errors that force
  1494 VAR_TEMP		return VAR_TEMP;		/* Keyword */
  1501 	 *       flex's main state machine to never change to the il_state or the st_state
  1495 VAR			return VAR;			/* Keyword */
  1502 	 *       after changing to the body_state.
  1496 NON_RETAIN		return NON_RETAIN;		/* Keyword */
  1503 	 *       Ths BEGIN(INITIAL) command forces the flex state machine to re-synchronise with 
  1497 END_VAR			return END_VAR;			/* Keyword */
  1504 	 *       the input stream even in the presence of buggy code!
       
  1505 	 */
       
  1506 FUNCTION_BLOCK				return FUNCTION_BLOCK;		/* Keyword */
       
  1507 END_FUNCTION_BLOCK	BEGIN(INITIAL);	return END_FUNCTION_BLOCK;	/* Keyword */  /* see Note above */
       
  1508 VAR_TEMP				return VAR_TEMP;		/* Keyword */
       
  1509 VAR					return VAR;			/* Keyword */
       
  1510 NON_RETAIN				return NON_RETAIN;		/* Keyword */
       
  1511 END_VAR					return END_VAR;			/* Keyword */
  1498 
  1512 
  1499 
  1513 
  1500 	/**********************/
  1514 	/**********************/
  1501 	/* B 1.5.3 - Programs */
  1515 	/* B 1.5.3 - Programs */
  1502 	/**********************/
  1516 	/**********************/
  1503 PROGRAM		return PROGRAM;			/* Keyword */
  1517 	/* Note: The following END_PROGRAM rule includes a BEGIN(INITIAL); command.
  1504 END_PROGRAM	return END_PROGRAM;		/* Keyword */
  1518 	 *       This is necessary in case the input program being pased has syntax errors that force
       
  1519 	 *       flex's main state machine to never change to the il_state or the st_state
       
  1520 	 *       after changing to the body_state.
       
  1521 	 *       Ths BEGIN(INITIAL) command forces the flex state machine to re-synchronise with 
       
  1522 	 *       the input stream even in the presence of buggy code!
       
  1523 	 */
       
  1524 PROGRAM				return PROGRAM;				/* Keyword */
       
  1525 END_PROGRAM	BEGIN(INITIAL);	return END_PROGRAM;			/* Keyword */  /* see Note above */
  1505 
  1526 
  1506 
  1527 
  1507 	/********************************************/
  1528 	/********************************************/
  1508 	/* B 1.6 Sequential Function Chart elements */
  1529 	/* B 1.6 Sequential Function Chart elements */
  1509 	/********************************************/
  1530 	/********************************************/
  1547 
  1568 
  1548 
  1569 
  1549 	/********************************/
  1570 	/********************************/
  1550 	/* B 1.7 Configuration elements */
  1571 	/* B 1.7 Configuration elements */
  1551 	/********************************/
  1572 	/********************************/
  1552 CONFIGURATION		return CONFIGURATION;		/* Keyword */
  1573 	/* Note: The following END_CONFIGURATION rule will never get to be used, as we have
  1553 END_CONFIGURATION	return END_CONFIGURATION;	/* Keyword */
  1574 	 *       another identical rule above (closer to the rules handling the transitions
  1554 TASK			return TASK;			/* Keyword */
  1575 	 *       of the main state machine) that will always execute before this one.
  1555 RESOURCE		return RESOURCE;		/* Keyword */
  1576 	 * Note: The following END_CONFIGURATION rule includes a BEGIN(INITIAL); command.
  1556 ON			return ON;			/* Keyword */
  1577 	 *       This is nt strictly necessary, but I place it here so it follwos the same
  1557 END_RESOURCE		return END_RESOURCE;		/* Keyword */
  1578 	 *       pattern used in END_FUNCTION, END_PROGRAM, and END_FUNCTION_BLOCK
  1558 VAR_CONFIG		return VAR_CONFIG;		/* Keyword */
  1579 	 */
  1559 VAR_ACCESS		return VAR_ACCESS;		/* Keyword */
  1580 CONFIGURATION				return CONFIGURATION;		/* Keyword */
  1560 END_VAR			return END_VAR;			/* Keyword */
  1581 END_CONFIGURATION	BEGIN(INITIAL); return END_CONFIGURATION;	/* Keyword */   /* see 2 Notes above! */
  1561 WITH			return WITH;			/* Keyword */
  1582 TASK					return TASK;			/* Keyword */
  1562 PROGRAM			return PROGRAM;			/* Keyword */
  1583 RESOURCE				return RESOURCE;		/* Keyword */
  1563 RETAIN			return RETAIN;			/* Keyword */
  1584 ON					return ON;			/* Keyword */
  1564 NON_RETAIN		return NON_RETAIN;		/* Keyword */
  1585 END_RESOURCE				return END_RESOURCE;		/* Keyword */
  1565 READ_WRITE		return READ_WRITE;		/* Keyword */
  1586 VAR_CONFIG				return VAR_CONFIG;		/* Keyword */
  1566 READ_ONLY		return READ_ONLY;		/* Keyword */
  1587 VAR_ACCESS				return VAR_ACCESS;		/* Keyword */
       
  1588 END_VAR					return END_VAR;			/* Keyword */
       
  1589 WITH					return WITH;			/* Keyword */
       
  1590 PROGRAM					return PROGRAM;			/* Keyword */
       
  1591 RETAIN					return RETAIN;			/* Keyword */
       
  1592 NON_RETAIN				return NON_RETAIN;		/* Keyword */
       
  1593 READ_WRITE				return READ_WRITE;		/* Keyword */
       
  1594 READ_ONLY				return READ_ONLY;		/* Keyword */
  1567 
  1595 
  1568 	/* PRIORITY, SINGLE and INTERVAL are not a keywords, so we only return them when 
  1596 	/* PRIORITY, SINGLE and INTERVAL are not a keywords, so we only return them when 
  1569 	 * it is explicitly required and we are not expecting any identifiers
  1597 	 * it is explicitly required and we are not expecting any identifiers
  1570 	 * that could also use the same letter sequence (i.e. an identifier: piority, ...)
  1598 	 * that could also use the same letter sequence (i.e. an identifier: piority, ...)
  1571 	 */
  1599 	 */