summaryrefslogtreecommitdiff
path: root/tests/examplefiles/example.bc
diff options
context:
space:
mode:
authorChristian Hammond <christian@beanbaginc.com>2016-11-04 16:57:38 -0700
committerChristian Hammond <christian@beanbaginc.com>2016-11-04 16:57:38 -0700
commit6ded9db39463372e5205a36bea72d6de516ece69 (patch)
tree1d1f497cc99dd44d2ee7e2c3daa35965157ff924 /tests/examplefiles/example.bc
downloadpygments-git-6ded9db39463372e5205a36bea72d6de516ece69.tar.gz
Add support for partials and path segments for Handlebars.
This introduces support for some missing features to the Handlebars lexer: Partials and path segments. Partials mostly appeared to work before, but the `>` in `{{> ... }}` would appear as a syntax error, as could other components of the partial. This change introduces support for: * Standard partials: `{{> partialName}}` * Partials with parameters: `{{> partialName varname="value"}}` * Ddynamic partials: `{{> (partialFunc)}}` * Ddynamic partials with lookups: `{{> (lookup ../path "partialName")}}` * Partial blocks: `{{> @partial-block}}` * Inline partials: `{{#*inline}}..{{/inline}}` It also introduces support for path segments, which can reference content in the current context or in a parent context. For instance, `this.name`, `this/name`, `./name`, `../name`, `this/name`, etc. These are all now tracked as variables.
Diffstat (limited to 'tests/examplefiles/example.bc')
-rw-r--r--tests/examplefiles/example.bc53
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/examplefiles/example.bc b/tests/examplefiles/example.bc
new file mode 100644
index 00000000..6604cd31
--- /dev/null
+++ b/tests/examplefiles/example.bc
@@ -0,0 +1,53 @@
+/*
+ * Calculate the Greatest Common Divisor of a and b.
+ */
+define gcd(a, b) {
+ auto tmp;
+
+ /*
+ * Euclidean algorithm
+ */
+ while (b != 0) {
+ tmp = a % b;
+ a = b;
+ b = tmp;
+ }
+ return a;
+}
+"gcd(225, 150) = " ; gcd(225, 150)
+
+/* assign operators */
+a = 10
+a += 1
+a++
+++a
+a--
+--a
+a += 5
+a -= 5
+a *= 2
+a /= 3
+a ^= 2
+a %= 2
+
+/* comparison */
+if (a > 2) {
+}
+if (a >= 2) {
+}
+if (a == 2) {
+}
+if (a != 2) {
+}
+if (a <= 2) {
+}
+if (a < 2) {
+}
+
+a /* /*/ * 2 /* == a * 2 */
+a //* /*/ 1.5 /* == a / 1.5 */
+a /*/*/ * 3 /* == a * 3 */
+a * 3 /**/ * 4 /* == a * 3 * 4 */
+a / 3 //*//*/ .4 /* == a / 3 / 0.4 */
+a / 3 //*//*/ 1.3 /* == a / 3 / 1.4 */
+a / 3 /*//*// 1.3 /* == a / 3 / 1.4 */