tests/syntax/sfc/sfc.txt
author Mario de Sousa <msousa@fe.up.pt>
Thu, 14 Apr 2011 18:12:59 +0100
changeset 287 9df7fcb9bde5
parent 109 3af0b849b9c6
permissions -rwxr-xr-x
Added tracking of order by which tokens are processed by lexical analyser.
This helps in correctly formating error messages when constructs begin in one file, and end in another.
PROGRAM MAIN_TEST
  VAR
    QX1 AT %QX1 : BOOL := 1;
    QX2 AT %QX2 : BOOL := 0;
    QX3 AT %QX3 : BOOL;
    IX1 AT %IX1 : BOOL;
    IX2 AT %IX2 : BOOL;
    IX3 AT %IX3 : BOOL;
  END_VAR

  INITIAL_STEP GO:
  END_STEP

  TRANSITION FROM GO TO STEP1
    := IX1 = FALSE;
  END_TRANSITION

  STEP STEP1:
    ONSTEP1(N);
  END_STEP

  ACTION ONSTEP1:
    QX1 := TRUE;
    QX2 := TRUE;
  END_ACTION

  TRANSITION FROM STEP1 TO STEP2
    := IX2 = TRUE;
  END_TRANSITION

  STEP STEP2:
    INLINE1(P);
  END_STEP

  ACTION INLINE1:
    QX1 := QX2 XOR QX1; QX2 := NOT QX2;
  END_ACTION

  TRANSITION FROM STEP2 TO A1
    := QX1 = FALSE AND QX2 = FALSE;
  END_TRANSITION

  STEP A1:
    INLINE2(N);
  END_STEP

  ACTION INLINE2:
    IX1 := TRUE;
  END_ACTION

  TRANSITION FROM A1 TO STEP2
    := IX1 = TRUE;
  END_TRANSITION

  TRANSITION FROM STEP2 TO (D1, D2, D3)
    := QX1 = TRUE AND QX2 = TRUE;
  END_TRANSITION

  STEP D1:
    INLINE5(N);
  END_STEP

  ACTION INLINE5:
    QX1 := FALSE;
  END_ACTION

  TRANSITION FROM D1 TO E1
    := NOT ( QX1 OR QX2 OR QX3 );
  END_TRANSITION

  STEP E1:
    INLINE8(N);
  END_STEP

  ACTION INLINE8:
    QX1 := TRUE;
  END_ACTION

  TRANSITION FROM (E1, E2, E3) TO GO
    := QX1 AND QX2 AND QX3;
  END_TRANSITION

  STEP D2:
    INLINE6(N);
  END_STEP

  ACTION INLINE6:
    QX2 := FALSE;
  END_ACTION

  TRANSITION FROM D2 TO E2
    := NOT ( QX1 OR QX2 OR QX3 );
  END_TRANSITION

  STEP E2:
    INLINE9(N);
  END_STEP

  ACTION INLINE9:
    QX2 := TRUE;
  END_ACTION

  STEP D3:
    INLINE7(N);
  END_STEP

  ACTION INLINE7:
    QX2 := FALSE;
  END_ACTION

  TRANSITION FROM D3 TO E3
    := NOT ( QX1 OR QX2 OR QX3 );
  END_TRANSITION

  STEP E3:
    INLINE10(N);
  END_STEP

  ACTION INLINE10:
    QX3 := TRUE;
  END_ACTION

  TRANSITION FROM STEP2 TO A3
    := QX1 = TRUE AND QX2 = FALSE;
  END_TRANSITION

  STEP A3:
    INLINE4(N);
  END_STEP

  ACTION INLINE4:
    IX1 := TRUE;
  END_ACTION

  TRANSITION FROM A3 TO STEP2
    := IX1 = TRUE;
  END_TRANSITION

  TRANSITION FROM STEP2 TO A2
    := QX1 = FALSE AND QX2 = TRUE;
  END_TRANSITION

  STEP A2:
    INLINE3(N);
  END_STEP

  ACTION INLINE3:
    IX1 := FALSE;
  END_ACTION

  TRANSITION FROM A2 TO STEP2
    := IX1 = FALSE;
  END_TRANSITION

END_PROGRAM


CONFIGURATION STD_CONF

  RESOURCE STD_RESSOURCE ON BEREMIZ
    TASK STD_TASK(INTERVAL := t#100ms,PRIORITY := 0);
    PROGRAM MAIN_INSTANCE : MAIN_TEST;
  END_RESOURCE
END_CONFIGURATION