Index: modules/parser/pegTokenizer.pegjs.txt
===================================================================
--- modules/parser/pegTokenizer.pegjs.txt	(revision 114350)
+++ modules/parser/pegTokenizer.pegjs.txt	(working copy)
@@ -439,6 +454,7 @@
             // avoid a paragraph if we know that the line starts with a block tag
             / bt:block_tag { return [bt] } 
             ) { return r; }
+    / behavior_switch
     / paragraph
     // Inlineline includes generic tags; wrapped into paragraphs in token
     // transform and DOM postprocessor
@@ -480,7 +496,15 @@
   / pre_indent
   / pre
 
+/*
+ * Behavior switches are layout commands like __NOTOC__
+ */
+behavior_switch_magic_word = "NOTOC" / "FORCETOC" / "TOC" / "NOEDITSECTION" / "NEWSECTIONLINK" / "NONEWSECTIONLINK" / "NOGALLERY" / "HIDDENCAT" / "NOCONTENTCONVERT" / "NOCC" / "NOTITLECONVERT" / "NOTC" / "START" / "END" / "INDEX" / "NOINDEX" / "STATICREDIRECT"
 
+behavior_switch = "__" w:behavior_switch_magic_word "__" {
+    return true;
+  }
+
 /*
  * A paragraph. We don't emit 'p' tokens to avoid issues with template
  * transclusions, <p> tags in the source and the like. Instead, we perform
