You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.4 KiB

  1. <!doctype html>
  2. <title>CodeMirror: Pig Latin mode</title>
  3. <meta charset="utf-8"/>
  4. <link rel=stylesheet href="../../doc/docs.css">
  5. <link rel="stylesheet" href="../../lib/codemirror.css">
  6. <script src="../../lib/codemirror.js"></script>
  7. <script src="pig.js"></script>
  8. <style>.CodeMirror {border: 2px inset #dee;}</style>
  9. <div id=nav>
  10. <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
  11. <ul>
  12. <li><a href="../../index.html">Home</a>
  13. <li><a href="../../doc/manual.html">Manual</a>
  14. <li><a href="https://github.com/codemirror/codemirror">Code</a>
  15. </ul>
  16. <ul>
  17. <li><a href="../index.html">Language modes</a>
  18. <li><a class=active href="#">Pig Latin</a>
  19. </ul>
  20. </div>
  21. <article>
  22. <h2>Pig Latin mode</h2>
  23. <form><textarea id="code" name="code">
  24. -- Apache Pig (Pig Latin Language) Demo
  25. /*
  26. This is a multiline comment.
  27. */
  28. a = LOAD "\path\to\input" USING PigStorage('\t') AS (x:long, y:chararray, z:bytearray);
  29. b = GROUP a BY (x,y,3+4);
  30. c = FOREACH b GENERATE flatten(group) as (x,y), SUM(group.$2) as z;
  31. STORE c INTO "\path\to\output";
  32. --
  33. </textarea></form>
  34. <script>
  35. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  36. lineNumbers: true,
  37. indentUnit: 4,
  38. mode: "text/x-pig"
  39. });
  40. </script>
  41. <p>
  42. Simple mode that handles Pig Latin language.
  43. </p>
  44. <p><strong>MIME type defined:</strong> <code>text/x-pig</code>
  45. (PIG code)
  46. </article>