Playground

srcML v1.1.0

Source View

            
srcML View

            

Playground Help

Collapse or expand code sections using the gutter arrows when line numbers are shown. Folding also works in read-only mode.

Drag source tabs to reorder them, or focus a tab and press Alt+Shift+Left/Right. Embed links preserve the tab order.

Open Queries at the bottom to run multiple XPath or srcQL queries. Each query has its own color and enable switch. Entries start at one line; resize an entry for multiline queries. Ctrl+Enter or Command+Enter runs the current query.

Full Page uses the current playground across the window. Move to the top edge to reveal navigation, or press Escape to return to the normal page.

Reload restores your open files, edits, queries, and panel layout. Undo history and unopened project files are not saved. Open a source again to fetch a newer version. Clear Workspace resets files and queries while keeping appearance, embed options, and panel layout.

Keyboard shortcuts

ActionShortcut
Next source tabAlt+PageDown
Previous source tabAlt+PageUp
Close source tabAlt+Shift+W
Previous themeCtrl+Alt+[
Next themeCtrl+Alt+]
Previous fontCtrl+Alt+,
Next fontCtrl+Alt+.
Decrease font sizeCtrl+Alt+−
Increase font sizeCtrl+Alt++ (the +/= key)

Themes and fonts cycle through the available choices; font size stops at the smallest and largest choices.

URL Help

The inputs of the playground can be given as parameters in the query (after the ?) or the hash (after the #) of its URL. The hash is not sent to the server, so it can hold more, e.g., the code.

ParameterInputExample
language Source language: ?language=Java
code Source code as text ?language=cpp&code=%0Aint%20n%20%3D%201%3B%0A
z Source code, compressed, as made by Copy Link ?language=cpp#z=1.48rMK1HIU7BVMLTmAgA
url (or src) Source file at a URL, which must allow cross-origin requests (CORS) ?url=https://raw.githubusercontent.com/srcML/srcML/master/src/libsrcml/srcml.h
srcml srcML archive at a URL, .xml or .xml.gz ?srcml=/doc/playground/examples/shapes.xml.gz&path=java/Shape.java
github GitHub repository, as owner/repo ?github=antirez/kilo
gist Gist URL or ID. All supported source files open in tabs. ?gist=GIST_ID
ref Branch, tag, or commit of a repository, or a gist revision. Defaults to the latest version. ?github=srcML/srcML&ref=v1.0.0
path File selected from the repository, archive, or gist, by default the first ?github=srcML/srcML&path=src/libsrcml/srcml.h
hash Hash attribute: 1 or 0 ?language=cpp&code=%0Aint%20n%20%3D%201%3B%0A&hash=1
positions (or pos) Position attributes: 1 or 0 ?language=cpp&code=%0Aint%20n%20%3D%201%3B%0A&positions=1
xpath XPath query, run after each parse ?language=cpp&code=%0Aint%20f()%3B%0A&xpath=//src:function_decl
srcql srcQL query, run after each parse ?language=cpp&code=%0Aint%20n%20%3D%201%3B%0Adouble%20d%20%3D%202%3B%0A&srcql=int%20%24N%20%3D%20%24E%3B
line Position or selection in the source: a line, line:column, or a range of them, e.g., 12-15 or 12:5-15:3 ?srcml=/doc/playground/examples/shapes.xml.gz&path=cpp/shape.hpp&line=17-26
panel Sidebar panel: files, open, tree, search, save, share, settings, or none ?panel=tree
fullPage Use the full window in the regular playground, with site navigation revealed at the top edge: 1 or 0 ?fullPage=1
showLineNumbers Show line numbers: 1 or 0 ?showLineNumbers=0
readOnly Prevent source edits while allowing selection, copying, and folding: 1 or 0 ?readOnly=1
hideSingleTab Hide tab headers when one source file is open: 1 or 0 ?hideSingleTab=1
hideSource, hideSrcML Hide an editor pane: 1 or 0. At least one pane stays visible. ?hideSrcML=1
queries Compressed query entries, including types, colors, and enabled state. Included in share and embed links. Use Copy Link or Copy Embed Link
tabs Compressed source files and selected tab, included by Open Embed and Copy Embed Link Use Copy Embed Link to include all open tabs
split Width of the source editor, as a percentage from 20 to 80 ?split=30

Parameters can be combined, e.g., a file from an archive, with a query and position attributes:

?srcml=/doc/playground/examples/shapes.xml.gz&path=cpp/shape.hpp&xpath=//src:class/src:name&positions=1

Only one source is used, the first of code (or z), url, srcml, github, and gist. The URL is kept up to date as the source, language, options, query, and position in the source change.