Permalink
Browse files

Parse a full file!

  • Loading branch information...
1 parent f56b998 commit 8c25fdba069e674f3a53b06eb29f5780afd866f6 @colomon committed Sep 4, 2012
Showing with 94,099 additions and 1 deletion.
  1. +12 −1 lib/ISO_10303_21/Grammar.pm
  2. +19 −0 t/03-exchange-structure.t
  3. +14 −0 t/04-read-files.t
  4. +3,852 −0 t/CAx/as1-id-203.stp
  5. +2,560 −0 t/CAx/as1-tc-214.stp
  6. +2,335 −0 t/CAx/boot.stp
  7. +41,642 −0 t/CAx/clamp.sat
  8. +19,309 −0 t/CAx/clamp.stp
  9. +1,322 −0 t/CAx/conrod.stp
  10. +991 −0 t/CAx/io1-cm-214.stp
  11. +1,250 −0 t/CAx/io1-pe-203.stp
  12. +1,591 −0 t/CAx/io1-tu-203.stp
  13. +514 −0 t/CAx/io1-ug-214.stp
  14. +118 −0 t/CAx/s1-c5-214/FOOT.stp
  15. +73 −0 t/CAx/s1-c5-214/FOOT.stp.log
  16. +449 −0 t/CAx/s1-c5-214/FOOT_BACK_000.stp
  17. +25 −0 t/CAx/s1-c5-214/FOOT_BACK_000.stp.log
  18. +449 −0 t/CAx/s1-c5-214/FOOT_FRONT_000.stp
  19. +25 −0 t/CAx/s1-c5-214/FOOT_FRONT_000.stp.log
  20. +118 −0 t/CAx/s1-c5-214/HEAD.stp
  21. +73 −0 t/CAx/s1-c5-214/HEAD.stp.log
  22. +608 −0 t/CAx/s1-c5-214/HEAD_BACK.stp
  23. +25 −0 t/CAx/s1-c5-214/HEAD_BACK.stp.log
  24. +227 −0 t/CAx/s1-c5-214/HEAD_FRONT.stp
  25. +25 −0 t/CAx/s1-c5-214/HEAD_FRONT.stp.log
  26. +118 −0 t/CAx/s1-c5-214/MAINBODY.stp
  27. +73 −0 t/CAx/s1-c5-214/MAINBODY.stp.log
  28. +1,500 −0 t/CAx/s1-c5-214/MAINBODY_BACK.stp
  29. +25 −0 t/CAx/s1-c5-214/MAINBODY_BACK.stp.log
  30. +1,139 −0 t/CAx/s1-c5-214/MAINBODY_FRONT.stp
  31. +25 −0 t/CAx/s1-c5-214/MAINBODY_FRONT.stp.log
  32. +131 −0 t/CAx/s1-c5-214/TAIL.stp
  33. +73 −0 t/CAx/s1-c5-214/TAIL.stp.log
  34. +716 −0 t/CAx/s1-c5-214/TAIL_MIDDLE_PART.stp
  35. +25 −0 t/CAx/s1-c5-214/TAIL_MIDDLE_PART.stp.log
  36. +717 −0 t/CAx/s1-c5-214/TAIL_TURBINE.stp
  37. +25 −0 t/CAx/s1-c5-214/TAIL_TURBINE.stp.log
  38. +211 −0 t/CAx/s1-c5-214/s1-c5-214.stp
  39. +115 −0 t/CAx/s1-c5-214/s1-c5-214.stp.log
  40. +6,501 −0 t/CAx/s1-id-214.stp
  41. +5,079 −0 t/CAx/s1-ug-203.stp
@@ -54,5 +54,16 @@ grammar ISO_10303_21::Grammar
rule simple_entity_instance { <entity_instance_name> '=' <simple_record> ';' }
rule complex_entity_instance { <entity_instance_name> '=' <subsuper_record> ';' }
rule entity_instance { <simple_entity_instance> | <complex_entity_instance> }
-
+
+ rule data_section {
+ "DATA" [ '(' <parameter_list> ')']? ';'
+ <entity_instance>*
+ "ENDSEC" ';'
+ }
+
+ rule exchange_file {
+ "ISO-10303-21;"
+ <header_section> <data_section>+
+ "END-ISO-10303-21;"
+ }
}
View
@@ -84,5 +84,24 @@ for @entities -> $entity {
ok $match, "<entity_instance> matches $entity - 2";
}
+{
+ my $data =
+q[DATA;
+#1=DIMENSIONAL_EXPONENTS(1.0,0.0,0.0,0.0,0.0,0.0,0.0);
+#2=DIMENSIONAL_EXPONENTS(0.0,0.0,0.0,0.0,0.0,0.0,0.0);
+#3=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT());
+#4=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.));
+#5=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.));
+#6=CARTESIAN_POINT('#6',(0.0,0.0,0.0));
+#7=DIRECTION('#7',(1.0,0.0,0.0));
+#8=DIRECTION('#8',(0.0,0.0,1.0));
+#9=AXIS2_PLACEMENT_3D('#9',#6,#8,#7);
+ENDSEC;];
+
+ my $match = ISO_10303_21::Grammar.parse($data, :rule<data_section>);
+ isa_ok $match, Match, "<data_section> matches a data - 1";
+ ok $match, "<data_section> matches a data - 2";
+}
+
done;
View
@@ -0,0 +1,14 @@
+use v6;
+use Test;
+use ISO_10303_21::Grammar;
+
+my @files = <t/CAx/conrod.stp>;
+
+for @files -> $file {
+ my $file-data = slurp($file);
+ my $match = ISO_10303_21::Grammar.parse($file-data, :rule<exchange_file>);
+ isa_ok $match, Match, "<exchange_file> matches $file - 1";
+ ok $match, "<exchange_file> matches $file - 2";
+}
+
+done;
Oops, something went wrong.

0 comments on commit 8c25fdb

Please sign in to comment.