commit 0de0e1474fb2a0c21fc40bccad7203da8fb55e6b
parent 978d7cb1cdff0ba8786f102c37cdd950229cf583
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 15 Mar 2017 14:45:42 +0100
Remove the test on the "input" specification draft
Uncomment the input specification to make clearer the reading.
Diffstat:
2 files changed, 247 insertions(+), 244 deletions(-)
diff --git a/cmake/parser/CMakeLists.txt b/cmake/parser/CMakeLists.txt
@@ -68,8 +68,6 @@ if(NOT NO_TEST)
endfunction()
build_test(test_solparser)
- add_test(test_grammar_example test_solparser
- ${PROJECT_SOURCE_DIR}/../../doc/input)
add_test(test_solparser_ok_0 test_solparser
${SOLPARSER_SOURCE_DIR}/yaml/test_ok_0.yaml)
add_test(test_solparser_ok_1 test_solparser
diff --git a/doc/input b/doc/input
@@ -1,6 +1,7 @@
-# --------------------------------------------------------------------------------
-# 1/ Exemple
-# --------------------------------------------------------------------------------
+#--------------------------------------------------------------------------------
+# 1/ Example
+#--------------------------------------------------------------------------------
+
# Declare materials
- material: &lambertian
matte:
@@ -77,243 +78,247 @@
transform: { translation: [10, 11, 12] }
children: [ *composition ]
-# --------------------------------------------------------------------------------
+#--------------------------------------------------------------------------------
# 2/ Grammar
-# --------------------------------------------------------------------------------
-# <solar-factory> ::=
-# <sun>
-# <items>
-#
-# <items> ::=
-# - <item>
-# [ - <item> ... ]
-#
-# <item> ::=
-# <geometry>
-# | <material>
-# | <entity>
-# | <template>
-#
-# ----------------------------------------
-# <geometry> ::=
-# geometry:
-# - <object>
-# [ - <object> ... ]
-#
-# <object> ::=
-# <shape>
-# <material>
-# [ <transform> ]
-#
-# <x_pivot> ::=
-# x_pivot:
-# [ ref_point: <real3>. Default 0,0,0 ]
-# <target>
-#
-# <zx_pivot> ::=
-# zx_pivot:
-# [ spacing: REAL # in [0, INF). Default 0 ]
-# [ ref_point: <real3>. Default 0,0,0 ]
-# <target>
-#
-# <target> ::=
-# target:
-# anchor: <anchor-identifier>
-# | direction: <real3>
-# | position: <real3>
-# | <sun>
-#
-# ----------------------------------------
-# <shape> ::=
-# <cuboid>
-# | <cylinder>
-# | <obj>
-# | <parabol>
-# | <parabolic-cylinder>
-# | <hyperbol>
-# | <plane>
-# | <sphere>
-# | <stl>
-#
-# <cuboid> ::=
-# cuboid:
-# size: <real3*+>
-#
-# <cylinder> ::=
-# cylinder:
-# height: REAL # in ]0, INF)
-# radius: REAL # in ]0, INF)
-# [ slices: INTEGER ] # in [4, 4096]. Default 16
-#
-# <obj> ::=
-# obj:
-# path: PATH
-#
-# <parabol> ::=
-# parabol: # x^2 + y^2 - 4*focal*z = 0
-# focal: REAL # in ]0, INF)
-# clip: <polyclip-list>
-#
-# <parabolic-cylinder> ::=
-# parabolic-cylinder: # y^2 - 4*focal*z = 0
-# focal: REAL # in ]0, INF)
-# clip: <polyclip-list>
-#
-# <hyperbol> ::= # (x^2 + y^2) / a^2 - (z + z0 - g/2)^2 / b^2 + 1 = 0
-# hyperbol: # with g = img_focal + real_focal; f = real_focal / g;
-# # a^2 = g^2(f - f^2); b = g(f - 1/2); z0 = |b| + g/2
-# focals: <hyperboloid_focals>
-# clip: <polyclip-list>
-#
-# <hyperboloid_focals> ::=
-# real: REAL # in ]0, INF)
-# image: REAL # in ]0, INF)
-#
-# <plane> ::=
-# plane:
-# clip: <polyclip-list>
-#
-# <sphere> ::=
-# sphere:
-# radius: REAL # in ]0, INF)
-# [ slices: INTEGER ] # in [4, 4096]. Default 16
-#
-# <stl> ::=
-# stl:
-# path: PATH
-#
-# ----------------------------------------
-# <polyclip-list> ::=
-# - <polyclip>
-# [ - <polyclip> ... ]
-#
-# <polyclip> ::=
-# operation: <AND|SUB>
-# vertices: <vertices-list>
-#
-# <vertices-list> ::=
-# - <real2>
-# - <real2>
-# - <real2>
-# [ - <real2> ... ]
-#
-# ----------------------------------------
-# <material> ::=
-# <material-descriptor> | <double-sided-material>
-#
-# <double-sided-material> ::=
-# front: <material-descriptor>
-# back: <material-descriptor>
-#
-# <material-descriptor> ::=
-# <mirror> | <matte> | <thin-dielectric> | <virtual>
-#
-# <mirror> ::=
-# mirror:
-# reflectivity: REAL # in [0, 1]
-# roughness: REAL # in [0, 1]
-#
-# <matte> ::=
-# matte:
-# reflectivity: REAL # in [0, 1]
-#
-# <virtual> ::=
-# virtual: EMPTY-STRING
-#
-# <thin-dielectric> ::=
-# thin_dielectric:
-# absorption: REAL # in [0, INF)
-# thickness: REAL # in [0, INF)
-# refractive_index: REAL # in ]0, INF)
-#
-# ----------------------------------------
-# <entity> ::=
-# entity:
-# <entity-data>
-#
-# <template> ::=
-# template:
-# <entity-data>
-#
-# <entity-data> ::=
-# name: STRING # except "self"
-# [ <geometry-data> | <x_pivot> | <zx_pivot> ]
-# [ <anchors> ]
-# [ <transform> ]
-# [ <children> ]
-#
-# <geometry-data> ::=
-# primary: INTEGER # in [0, 1]
-# <geometry>
-#
-# <children> ::=
-# children:
-# - <entity-data>
-# [ - <entity-data> ... ]
-#
-# <anchors> ::=
-# anchors:
-# - <anchor-data>
-# [ - <anchor-data> ... ]
-#
-# <anchor-data> ::=
-# name: STRING
-# <position-description>
-#
-# <position-description> ::=
-# position: <real3> | hyperboloid_image_focals: <hyperboloid_focals>
-#
-# # "self" references the first level entity
-# <entity-identifier> ::=
-# <self|STRING>[.STRING ... ]
-#
-# <anchor-identifier> ::=
-# <entity-identifier>.STRING
-#
-# ----------------------------------------
-# <sun> ::=
-# sun:
-# dni: REAL # Direct Normal Irradiance in ]0, INF)
-# <spectrum>
-# [ <radial-angular-distribution> ]
-#
-# <radial-angular-distribution> ::=
-# <pillbox> | <buie>
-#
-# <buie> ::=
-# buie:
-# csr: REAL # in [1e-6, 0.849]
-#
-# <pillbox> ::=
-# pillbox:
-# aperture: REAL # in ]0, 90]
-#
-# ----------------------------------------
-# <transform> ::=
-# transform:
-# translation: <real3>
-# rotation: <real3>
-#
-# <real2> ::=
-# - REAL
-# - REAL
-#
-# <real3> ::=
-# - REAL
-# - REAL
-# - REAL
-#
-# <real3*+> ::=
-# - REAL # in ]0, inf)
-# - REAL # in ]0, inf)
-# - REAL # in ]0, inf)
-#
-# <spectrum> ::=
-# spectrum:
-# - <spectrum-data>
-# [ - <spectrum-data> ... ]
-#
-# <spectrum-data> ::=
-# wavelength: REAL # in [0, INF)
-# data: REAL # in [0, INF)
-#
+#--------------------------------------------------------------------------------
+<solar-factory> ::=
+ <sun>
+ <items>
+
+<items> ::=
+ - <item>
+[ - <item> ... ]
+
+<item> ::=
+ <geometry>
+ | <material>
+ | <entity>
+ | <template>
+
+----------------------------------------
+<geometry> ::=
+ geometry:
+ - <object>
+[ - <object> ... ]
+
+<object> ::=
+ <shape>
+ <material>
+[ <transform> ]
+
+<x_pivot> ::=
+ x_pivot:
+[ ref_point: <real3>. Default 0,0,0 ]
+ <target>
+
+<zx_pivot> ::=
+ zx_pivot:
+[ spacing: REAL # in [0, INF). Default 0 ]
+[ ref_point: <real3>. Default 0,0,0 ]
+ <target>
+
+<target> ::=
+ target:
+ anchor: <anchor-identifier>
+ | direction: <real3>
+ | position: <real3>
+ | <sun>
+
+----------------------------------------
+<shape> ::=
+ <cuboid>
+ | <cylinder>
+ | <obj>
+ | <parabol>
+ | <parabolic-cylinder>
+ | <hyperbol>
+ | <plane>
+ | <sphere>
+ | <stl>
+
+<cuboid> ::=
+ cuboid:
+ size: <real3*+>
+
+<cylinder> ::=
+ cylinder:
+ height: REAL # in ]0, INF)
+ radius: REAL # in ]0, INF)
+[ slices: INTEGER ] # in [4, 4096]. Default 16
+
+<obj> ::=
+ obj:
+ path: PATH
+
+# x^2 + y^2 - 4*focal*z = 0
+<parabol> ::=
+ parabol:
+ focal: REAL # in ]0, INF)
+ clip: <polyclip-list>
+
+<parabolic-cylinder> ::=
+ parabolic-cylinder: # y^2 - 4*focal*z = 0
+ focal: REAL # in ]0, INF)
+ clip: <polyclip-list>
+
+# (x^2 + y^2) / a^2 - (z + z0 - g/2)^2 / b^2 + 1 = 0
+# with g = img_focal + real_focal; f = real_focal / g;
+# a^2 = g^2(f - f^2); b = g(f - 1/2); z0 = |b| + g/2
+<hyperbol> ::=
+ hyperbol:
+ focals: <hyperboloid_focals>
+ clip: <polyclip-list>
+[ slices: INTEGER ] # in
+
+<hyperboloid_focals> ::=
+ real: REAL # in ]0, INF)
+ image: REAL # in ]0, INF)
+
+<plane> ::=
+ plane:
+ clip: <polyclip-list>
+
+<sphere> ::=
+ sphere:
+ radius: REAL # in ]0, INF)
+[ slices: INTEGER ] # in [4, 4096]. Default 16
+
+<stl> ::=
+ stl:
+ path: PATH
+
+----------------------------------------
+<polyclip-list> ::=
+ - <polyclip>
+[ - <polyclip> ... ]
+
+<polyclip> ::=
+ operation: <AND|SUB>
+ vertices: <vertices-list>
+
+<vertices-list> ::=
+ - <real2>
+ - <real2>
+ - <real2>
+[ - <real2> ... ]
+
+----------------------------------------
+<material> ::=
+ <material-descriptor> | <double-sided-material>
+
+<double-sided-material> ::=
+ front: <material-descriptor>
+ back: <material-descriptor>
+
+<material-descriptor> ::=
+ <mirror> | <matte> | <thin-dielectric> | <virtual>
+
+<mirror> ::=
+ mirror:
+ reflectivity: REAL # in [0, 1]
+ roughness: REAL # in [0, 1]
+
+<matte> ::=
+ matte:
+ reflectivity: REAL # in [0, 1]
+
+<virtual> ::=
+ virtual: EMPTY-STRING
+
+<thin-dielectric> ::=
+ thin_dielectric:
+ absorption: REAL # in [0, INF)
+ thickness: REAL # in [0, INF)
+ refractive_index: REAL # in ]0, INF)
+
+----------------------------------------
+<entity> ::=
+ entity:
+ <entity-data>
+
+<template> ::=
+ template:
+ <entity-data>
+
+<entity-data> ::=
+ name: STRING # except "self"
+[ <geometry-data> | <x_pivot> | <zx_pivot> ]
+[ <anchors> ]
+[ <transform> ]
+[ <children> ]
+
+<geometry-data> ::=
+ primary: INTEGER # in [0, 1]
+ <geometry>
+
+<children> ::=
+ children:
+ - <entity-data>
+[ - <entity-data> ... ]
+
+<anchors> ::=
+ anchors:
+ - <anchor-data>
+[ - <anchor-data> ... ]
+
+<anchor-data> ::=
+ name: STRING
+ <position-description>
+
+<position-description> ::=
+ position: <real3> | hyperboloid_image_focals: <hyperboloid_focals>
+
+# "self" references the first level entity
+<entity-identifier> ::=
+ <self|STRING>[.STRING ... ]
+
+<anchor-identifier> ::=
+ <entity-identifier>.STRING
+
+----------------------------------------
+<sun> ::=
+ sun:
+ dni: REAL # Direct Normal Irradiance in ]0, INF)
+ <spectrum>
+[ <radial-angular-distribution> ]
+
+<radial-angular-distribution> ::=
+ <pillbox> | <buie>
+
+<buie> ::=
+ buie:
+ csr: REAL # in [1e-6, 0.849]
+
+<pillbox> ::=
+ pillbox:
+ aperture: REAL # in ]0, 90]
+
+----------------------------------------
+<transform> ::=
+ transform:
+ translation: <real3>
+ rotation: <real3>
+
+<real2> ::=
+ - REAL
+ - REAL
+
+<real3> ::=
+ - REAL
+ - REAL
+ - REAL
+
+<real3*+> ::=
+ - REAL # in ]0, inf)
+ - REAL # in ]0, inf)
+ - REAL # in ]0, inf)
+
+<spectrum> ::=
+ spectrum:
+ - <spectrum-data>
+[ - <spectrum-data> ... ]
+
+<spectrum-data> ::=
+ wavelength: REAL # in [0, INF)
+ data: REAL # in [0, INF)
+