diff --git a/autotests/folding/test.jsx.fold b/autotests/folding/test.jsx.fold new file mode 100644 --- /dev/null +++ b/autotests/folding/test.jsx.fold @@ -0,0 +1,50 @@ +/* email: + * URL: https://reactjs.org/*/ + +import React from 'react'; +import { PhotoStory, VideoStory } from './stories'; + +function Story(props) { + const SpecificStory = components[props.storyType]; + return story={ props.story } attr2="&ref;" attr3="Hello\n" />; +} + +function + attr1={ /> function return class var 0x123 { } &noRef; hello() React.Component() } attr2="&ref;"> + /* no comment*/ function /> return class var 0x123 &ref; hello() React.Component() + ./> anyWord /> + { function return class var 0x123 hello() React.Component() } +> + +> > +> > +> > + +/*comment*/attr1/*comment*/= /*comment*/"value"/*comment*/attr2 /*comment*/attr3='a' key/*comment*/key2 /> + +// Detect Valid tags + +/* comment */ >> +{ /* comment + */ /> + word . } +return /* comment + multiline */ /> /* comment */ /> +&& /*comment*/ /> +& /*comment*/ + + /> +{ >Hello> } +? />; +[ /> ( /> +,/> =/> +&&/> ||/> +return /> ; +default/> ; +> > /> > return > + +anyWord +anyWord/*comment*/ +. +& | +% /* comment*/ diff --git a/autotests/html/test.jsx.html b/autotests/html/test.jsx.html new file mode 100644 --- /dev/null +++ b/autotests/html/test.jsx.html @@ -0,0 +1,57 @@ + + + +test.jsx + +
+/* email: <willy@wmail.com>
+ * URL: https://reactjs.org/*/
+
+import React from 'react';
+import { PhotoStory, VideoStory } from './stories';
+
+function Story(props) {
+  const SpecificStory = components[props.storyType];
+  return <SpecificStory story={ props.story } attr2="&ref;" attr3="Hello\n" />;
+} 
+
+function 
+<Tag attr1={ <tag/> function <noTag/> return class var 0x123 { } &noRef; hello() React.Component() } attr2="&ref;">
+	/* no comment*/ function <tag/> return class var 0x123 &ref; hello() React.Component()
+	.<tag/> anyWord <tag/>
+	{ function <tag> return class var 0x123 hello() React.Component() } 
+</Tag>
+
+<tag1> </tag1>
+<tag1> </Tag$>
+<Tag$> </tag>
+
+<tag/*comment*/attr1/*comment*/= /*comment*/"value"/*comment*/attr2 /*comment*/attr3='a' key/*comment*/key2 />
+
+// Detect Valid tags
+
+/* comment */ <tag></tag>
+{ /* comment 
+	*/ <Tag /> 
+	word <noTag/> . <noTag/> } <noTag/>
+return /* comment
+	multiline */ <tag/> /* comment */ <Tag/>
+&& /*comment*/ <Tag/>
+& /*comment*/ <noTag/>
+
+  <tag/>
+{ <hello>Hello</hello> }
+?<Tag />;
+[ <tag />  ( <tag />
+,<Tag/>    =<Tag/>
+&&<tag/>   ||<tag/>
+return <tag/> ;
+default<tag/> ;
+<Tag> <tag> <tag$/> </tag> return </Tag>
+
+anyWord<noTag>
+anyWord/*comment*/ <noTag/>
+.<noTag>
+&<notag> | <noTag/>
+% /* comment*/ <noTag/>
+
diff --git a/autotests/input/test.jsx b/autotests/input/test.jsx new file mode 100644 --- /dev/null +++ b/autotests/input/test.jsx @@ -0,0 +1,50 @@ +/* email: + * URL: https://reactjs.org/*/ + +import React from 'react'; +import { PhotoStory, VideoStory } from './stories'; + +function Story(props) { + const SpecificStory = components[props.storyType]; + return ; +} + +function + function return class var 0x123 { } &noRef; hello() React.Component() } attr2="&ref;"> + /* no comment*/ function return class var 0x123 &ref; hello() React.Component() + . anyWord + { function return class var 0x123 hello() React.Component() } + + + + + + + + +// Detect Valid tags + +/* comment */ +{ /* comment + */ + word . } +return /* comment + multiline */ /* comment */ +&& /*comment*/ +& /*comment*/ + + +{ Hello } +?; +[ ( +, = +&& || +return ; +default ; + return + +anyWord +anyWord/*comment*/ +. +& | +% /* comment*/ diff --git a/autotests/reference/test.jsx.ref b/autotests/reference/test.jsx.ref new file mode 100644 --- /dev/null +++ b/autotests/reference/test.jsx.ref @@ -0,0 +1,50 @@ +/* email: <willy@wmail.com>
+ * URL: https://reactjs.org/*/
+
+import React from 'react';
+import { PhotoStory, VideoStory } from './stories';
+
+function Story(props) {
+ const SpecificStory = components[props.storyType];
+ return story={ props.story } attr2="&ref;" attr3="Hello\n" />;
+}
+
+function
+ attr1={ function <noTag/> return class var 0x123 { } &noRef; hello() React.Component() } attr2="&ref;">
+ /* no comment*/ function return class var 0x123 &ref; hello() React.Component()
+ . anyWord
+ { function <tag> return class var 0x123 hello() React.Component() }
+

+
+
+ Tag$>
+

+
+/*comment*/attr1/*comment*/= /*comment*/"value"/*comment*/attr2 /*comment*/attr3='a' key/*comment*/key2 />
+
+// Detect Valid tags
+
+/* comment */
+{ /* comment
+ */ />
+ word <noTag/> . <noTag/> } <noTag/>
+return /* comment
+ multiline */ /* comment */
+&& /*comment*/
+& /*comment*/ <noTag/>
+
+
+{ Hello }
+? />;
+[ /> ( />
+, =
+&& ||
+return ;
+default ;
+
return

+
+anyWord<noTag>
+anyWord/*comment*/ <noTag/>
+.<noTag>
+&<notag> | <noTag/>
+% /* comment*/ <noTag/>
diff --git a/data/syntax/javascript-react.xml b/data/syntax/javascript-react.xml new file mode 100644 --- /dev/null +++ b/data/syntax/javascript-react.xml @@ -0,0 +1,261 @@ + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +