1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-26 02:05:08 +00:00
serenity/Libraries/LibGUI
mattco98 adb4accab3 LibJS: Add template literals
Adds fully functioning template literals. Because template literals
contain expressions, most of the work has to be done in the Lexer rather
than the Parser. And because of the complexity of template literals
(expressions, nesting, escapes, etc), the Lexer needs to have some
template-related state.

When entering a new template literal, a TemplateLiteralStart token is
emitted. When inside a literal, all text will be parsed up until a '${'
or '`' (or EOF, but that's a syntax error) is seen, and then a
TemplateLiteralExprStart token is emitted. At this point, the Lexer
proceeds as normal, however it keeps track of the number of opening
and closing curly braces it has seen in order to determine the close
of the expression. Once it finds a matching curly brace for the '${',
a TemplateLiteralExprEnd token is emitted and the state is updated
accordingly.

When the Lexer is inside of a template literal, but not an expression,
and sees a '`', this must be the closing grave: a TemplateLiteralEnd
token is emitted.

The state required to correctly parse template strings consists of a
vector (for nesting) of two pieces of information: whether or not we
are in a template expression (as opposed to a template string); and
the count of the number of unmatched open curly braces we have seen
(only applicable if the Lexer is currently in a template expression).

TODO: Add support for template literal newlines in the JS REPL (this will
cause a syntax error currently):

    > `foo
    > bar`
    'foo
    bar'
2020-05-04 16:46:31 +02:00
..
AboutDialog.cpp LibGUI: AboutDialog now inherits the icon of its parent window 2020-03-30 10:52:09 +02:00
AboutDialog.h LibGUI: Don't use Core::Object::add() to instantiate dialogs 2020-03-04 21:04:06 +01:00
AbstractButton.cpp LibGUI: Remove unnecessary is_enabled() checks in mouse event handlers 2020-04-29 19:17:40 +02:00
AbstractButton.h LibGUI: Move Icon and FontDatabase into the GUI namespace 2020-03-07 01:33:53 +01:00
AbstractTableView.cpp LibGUI: Display hidden columns as hidden 2020-05-02 14:12:36 +02:00
AbstractTableView.h LibGUI: Add a way for models to update without invalidating indexes 2020-04-12 12:03:33 +02:00
AbstractView.cpp FileManager+LibGUI: Allow drop on entire DirectoryView 2020-04-20 12:15:26 +02:00
AbstractView.h LibGUI: Remove unneeded access rights 2020-05-02 14:12:36 +02:00
Action.cpp Base: New "cut" action icon 2020-04-24 20:42:34 +02:00
Action.h LibGUI: Make it easier to create checkable GUI::Actions 2020-04-21 17:21:28 +02:00
ActionGroup.cpp LibGUI: Remove leading G from filenames 2020-02-06 20:33:02 +01:00
ActionGroup.h LibGUI: Add forwarding header 2020-02-16 09:41:56 +01:00
Application.cpp LibGUI: Make MenuBar a Core::Object 2020-04-21 16:19:18 +02:00
Application.h LibGUI: Make MenuBar a Core::Object 2020-04-21 16:19:18 +02:00
BoxLayout.cpp LibGUI: Make Layout a Core::Object and add basic serialization 2020-03-05 09:22:43 +01:00
BoxLayout.h LibGUI: Make Layout a Core::Object and add basic serialization 2020-03-05 09:22:43 +01:00
Button.cpp LibGUI: Brighten buttons when hovering over them :^) 2020-03-30 19:40:44 +02:00
Button.h LibGUI: Remove Button& parameter from Button::on_click hook 2020-03-03 17:02:38 +01:00
CheckBox.cpp LibGUI: Paint CheckBox background same as widget's if it's not enabled 2020-04-28 15:14:02 +02:00
CheckBox.h LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
Clipboard.cpp Kernel+LibC: Rename shared buffer syscalls to use a prefix 2020-02-28 12:55:58 +01:00
Clipboard.h LibGUI: Add forwarding header 2020-02-16 09:41:56 +01:00
ColorInput.cpp LibGUI: Require a full click on ColorInput's color rect to open picker 2020-04-29 19:17:40 +02:00
ColorInput.h LibGUI: Require a full click on ColorInput's color rect to open picker 2020-04-29 19:17:40 +02:00
ColorPicker.cpp LibGUI: Use "OK, Cancel" button order in ColorPicker 2020-04-29 19:29:09 +02:00
ColorPicker.h LibGUI: Transfer "color has alpha channel" state 2020-04-29 16:22:09 +02:00
ColumnsView.cpp LibGUI: Add a way for models to update without invalidating indexes 2020-04-12 12:03:33 +02:00
ColumnsView.h LibGUI: Add a way for models to update without invalidating indexes 2020-04-12 12:03:33 +02:00
ComboBox.cpp LibGUI: Make ComboBox list pop-up windows frameless 2020-05-02 01:29:55 +02:00
ComboBox.h LibGUI: ComboBox, add "set_selected_index" method 2020-03-29 19:36:37 +02:00
Command.cpp LibGUI: Remove leading G from filenames 2020-02-06 20:33:02 +01:00
Command.h LibGUI: Remove leading G from filenames 2020-02-06 20:33:02 +01:00
CppLexer.cpp LibGUI: Fix CppLexer assertion on incomplete #include statements 2020-04-04 11:00:14 +02:00
CppLexer.h LibGUI: Parse #include statements separately 2020-03-12 12:37:13 +01:00
CppSyntaxHighlighter.cpp LibGUI: Use themes for syntax highlighting 2020-03-16 13:39:34 +01:00
CppSyntaxHighlighter.h LibGUI: Use themes for syntax highlighting 2020-03-16 13:39:34 +01:00
Desktop.cpp LibGUI: Desktop, add methods for set background color and wallpaper mode 2020-03-29 19:36:37 +02:00
Desktop.h LibGUI: Desktop, add methods for set background color and wallpaper mode 2020-03-29 19:36:37 +02:00
Dialog.cpp LibGUI: Don't use Core::Object::add() to instantiate dialogs 2020-03-04 21:04:06 +01:00
Dialog.h LibGUI: Don't use Core::Object::add() to instantiate dialogs 2020-03-04 21:04:06 +01:00
DisplayLink.cpp WindowServer+LibGUI: Add a way to get notified at display refresh rate 2020-03-22 21:13:23 +01:00
DisplayLink.h WindowServer+LibGUI: Add a way to get notified at display refresh rate 2020-03-22 21:13:23 +01:00
DragOperation.cpp LibGfx+LibIPC: Add Gfx::ShareableBitmap, a bitmap for easy IPC usage 2020-03-29 19:37:23 +02:00
DragOperation.h LibGUI: Add forwarding header 2020-02-16 09:41:56 +01:00
Event.cpp LibGUI: Add missing Event.cpp file 2020-02-14 17:35:04 +01:00
Event.h WindowServer+LibGUI: Support the 4th and 5th mouse buttons 2020-05-02 22:07:43 +02:00
FilePicker.cpp LibGUI: FilePicker: Set initial sort to name instead of undefined 2020-05-02 14:12:36 +02:00
FilePicker.h LibCore: Add StandardPaths thing to retrieve various standard locations 2020-04-19 19:57:05 +02:00
FileSystemModel.cpp LibGUI: Create thumnail for gif files 2020-04-26 18:44:20 +02:00
FileSystemModel.h LibGUI: Icon for INI file type 2020-05-01 16:58:18 +02:00
FontDatabase.cpp LibGUI: Skip non-font files in the FontDatabase constructor 2020-03-11 21:27:03 +01:00
FontDatabase.h LibGUI: Move Icon and FontDatabase into the GUI namespace 2020-03-07 01:33:53 +01:00
Forward.h LibGUI: The UI calls it 'Icon view', fix the name in the code 2020-05-02 14:12:36 +02:00
Frame.cpp LibGUI: Introduce widget content margins + improve splitters 2020-04-24 19:05:02 +02:00
Frame.h LibGUI: Introduce widget content margins + improve splitters 2020-04-24 19:05:02 +02:00
GroupBox.cpp LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
GroupBox.h LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
Icon.cpp LibGUI: Move Icon and FontDatabase into the GUI namespace 2020-03-07 01:33:53 +01:00
Icon.h LibGUI: Move Icon and FontDatabase into the GUI namespace 2020-03-07 01:33:53 +01:00
IconView.cpp LibGUI: The UI calls it 'Icon view', fix the name in the code 2020-05-02 14:12:36 +02:00
IconView.h LibGUI: The UI calls it 'Icon view', fix the name in the code 2020-05-02 14:12:36 +02:00
INILexer.cpp LibGUI: INI file syntax highlighter 2020-05-01 16:58:18 +02:00
INILexer.h LibGUI: INI file syntax highlighter 2020-05-01 16:58:18 +02:00
INISyntaxHighlighter.cpp LibGUI: INI file syntax highlighter 2020-05-01 16:58:18 +02:00
INISyntaxHighlighter.h LibGUI: INI file syntax highlighter 2020-05-01 16:58:18 +02:00
InputBox.cpp LibGUI: Use "OK, Cancel" button order in InputBox 2020-04-29 19:31:15 +02:00
InputBox.h LibGUI: Don't use Core::Object::add() to instantiate dialogs 2020-03-04 21:04:06 +01:00
JsonArrayModel.cpp LibGUI: Add store(), add() and remove() methods to JsonArrayModel 2020-03-27 14:12:18 +01:00
JsonArrayModel.h LibGUI: Add store(), add() and remove() methods to JsonArrayModel 2020-03-27 14:12:18 +01:00
JSSyntaxHighlighter.cpp LibJS: Add template literals 2020-05-04 16:46:31 +02:00
JSSyntaxHighlighter.h LibGUI: Use themes for syntax highlighting 2020-03-16 13:39:34 +01:00
Label.cpp LibGUI: Make Label::set_icon() take a const Gfx::Bitmap* 2020-03-29 19:37:23 +02:00
Label.h LibGUI: Make Label::set_icon() take a const Gfx::Bitmap* 2020-03-29 19:37:23 +02:00
Layout.cpp AK: Add global FlatPtr typedef. It's u32 or u64, based on sizeof(void*) 2020-03-08 13:06:51 +01:00
Layout.h LibGUI: Make Layout a Core::Object and add basic serialization 2020-03-05 09:22:43 +01:00
LazyWidget.cpp LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
LazyWidget.h LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
ListView.cpp LibGUI: Make view widgets fill background by default 2020-04-18 21:55:37 +02:00
ListView.h LibGUI: Add a way for models to update without invalidating indexes 2020-04-12 12:03:33 +02:00
Makefile LibGUI: The UI calls it 'Icon view', fix the name in the code 2020-05-02 14:12:36 +02:00
Margins.h LibGUI: Remove leading G from filenames 2020-02-06 20:33:02 +01:00
Menu.cpp LibGUI: Simplify submenu construction 2020-04-29 11:48:11 +02:00
Menu.h LibGUI: Simplify submenu construction 2020-04-29 11:48:11 +02:00
MenuBar.cpp LibGUI: Make MenuBar a Core::Object 2020-04-21 16:19:18 +02:00
MenuBar.h LibGUI: Make MenuBar a Core::Object 2020-04-21 16:19:18 +02:00
MenuItem.cpp LibGUI: Simplify submenu construction 2020-04-29 11:48:11 +02:00
MenuItem.h LibGUI: Simplify submenu construction 2020-04-29 11:48:11 +02:00
MessageBox.cpp LibGUI: MessageBox min width control for show messages 2020-04-23 11:49:02 +02:00
MessageBox.h LibGUI: Don't use Core::Object::add() to instantiate dialogs 2020-03-04 21:04:06 +01:00
Model.cpp LibGUI: Add a way for models to update without invalidating indexes 2020-04-12 12:03:33 +02:00
Model.h LibGUI: Add a way for models to update without invalidating indexes 2020-04-12 12:03:33 +02:00
ModelEditingDelegate.h LibGUI: Make the ModelEditingDelegate constructor protected 2020-03-05 15:50:22 +01:00
ModelIndex.cpp LibGUI: Add forwarding header 2020-02-16 09:41:56 +01:00
ModelIndex.h LibGUI: Add forwarding header 2020-02-16 09:41:56 +01:00
ModelSelection.cpp LibGUI: Keep still-valid indexes in selection after a model update 2020-04-09 09:53:28 +02:00
ModelSelection.h LibGUI: Keep still-valid indexes in selection after a model update 2020-04-09 09:53:28 +02:00
MultiView.cpp LibGUI: FilePicker: Make icon view button initially checked 2020-05-02 14:12:36 +02:00
MultiView.h LibGUI: FilePicker: Make icon view button initially checked 2020-05-02 14:12:36 +02:00
Notification.cpp Meta: Add missing copyright headers 2020-04-06 11:09:01 +02:00
Notification.h Meta: Add missing copyright headers 2020-04-06 11:09:01 +02:00
Painter.cpp LibGfx: Add forward declaration header 2020-02-14 23:31:18 +01:00
Painter.h LibGUI: Add forwarding header 2020-02-16 09:41:56 +01:00
ProgressBar.cpp LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
ProgressBar.h LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
RadioButton.cpp LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
RadioButton.h LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
ResizeCorner.cpp LibGUI: Make sure the ResizeCorner aligns nicely inside StatusBar 2020-04-23 15:58:39 +02:00
ResizeCorner.h LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
ScrollableWidget.cpp LibGUI: Fix off-by-one in ScrollableWidget 2020-05-02 14:12:36 +02:00
ScrollableWidget.h LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
ScrollBar.cpp LibGUI: Tweak default ScrollBar size to make arrow icons centered :^) 2020-04-23 20:01:55 +02:00
ScrollBar.h LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
Shortcut.cpp AK: Make Vector use size_t for its size and capacity 2020-02-25 14:52:35 +01:00
Shortcut.h LibGUI: Add forwarding header 2020-02-16 09:41:56 +01:00
Slider.cpp LibGUI: Remove unnecessary is_enabled() checks in mouse event handlers 2020-04-29 19:17:40 +02:00
Slider.h LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
SortingProxyModel.cpp LibGUI: Add a way for models to update without invalidating indexes 2020-04-12 12:03:33 +02:00
SortingProxyModel.h LibGUI: Remove leading G from filenames 2020-02-06 20:33:02 +01:00
SpinBox.cpp LibGUI: Remove Button& parameter from Button::on_click hook 2020-03-03 17:02:38 +01:00
SpinBox.h LibGUI: Implement keyboard and mouse wheel events for SpinBox 2020-02-24 10:40:32 +01:00
Splitter.cpp LibGUI: Shrink GUI::Splitter by 1 pixel to make it look just right 2020-04-24 19:05:04 +02:00
Splitter.h LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
StackWidget.cpp LibGUI: Grant focus when activating a new stack/tab child widget 2020-04-24 14:34:24 +02:00
StackWidget.h LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
StatusBar.cpp LibGUI: Make StatusBar 2px shorter vertically for a snugger fit 2020-04-23 18:52:34 +02:00
StatusBar.h LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
SyntaxHighlighter.cpp LibGUI: Add missing copyright headers 2020-03-13 23:09:58 +01:00
SyntaxHighlighter.h LibGUI: INI file syntax highlighter 2020-05-01 16:58:18 +02:00
TableView.cpp LibGUI: Make view widgets fill background by default 2020-04-18 21:55:37 +02:00
TableView.h LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
TabWidget.cpp LibGUI: Scale TabWidget tabs according to available space 2020-04-30 09:28:36 +02:00
TabWidget.h LibGUI: Cycle through TabWidget tabs with Ctrl+Tab / Ctrl+Shift+Tab 2020-04-30 09:04:39 +02:00
TextBox.cpp LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
TextBox.h LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
TextDocument.cpp LibGUI: Fix null-termination of TextDocumentLine 2020-03-08 10:31:48 +01:00
TextDocument.h LibGUI: Remove friend classes of TextDocumentLine 2020-03-19 22:52:44 +01:00
TextEditor.cpp LibGUI: Paint TextEditor background same as widget's if it's not enabled 2020-04-28 15:14:02 +02:00
TextEditor.h HackStudio: GUI support for setting breakpoints on source code lines 2020-04-25 13:16:46 +02:00
TextPosition.h LibGUI: Remove remaining G prefixes 2020-03-19 22:52:44 +01:00
TextRange.h LibGUI: Remove remaining G prefixes 2020-03-19 22:52:44 +01:00
ToolBar.cpp LibGUI: Add a ToolBarContainer widget and put most ToolBars in one 2020-04-23 17:44:49 +02:00
ToolBar.h LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
ToolBarContainer.cpp LibGUI: Make ToolBarContainer better at reacting to child events 2020-04-25 17:16:05 +02:00
ToolBarContainer.h LibCore+LibHTTP: Move out the HTTP handler and add HTTPS 2020-05-02 12:24:10 +02:00
TreeView.cpp LibGUI: Make view widgets fill background by default 2020-04-18 21:55:37 +02:00
TreeView.h LibGUI: Add a way for models to update without invalidating indexes 2020-04-12 12:03:33 +02:00
UndoStack.cpp AK: Make Vector use size_t for its size and capacity 2020-02-25 14:52:35 +01:00
UndoStack.h AK: Make Vector use size_t for its size and capacity 2020-02-25 14:52:35 +01:00
Variant.cpp AK: Allow %m.nf specifier for double/float in printf to set fraction with 2020-04-07 09:02:02 +02:00
Variant.h LibGUI: Allow constructing Variant from FlyString 2020-03-22 19:06:31 +01:00
Widget.cpp LibGUI: Introduce widget content margins + improve splitters 2020-04-24 19:05:02 +02:00
Widget.h LibGUI: Introduce widget content margins + improve splitters 2020-04-24 19:05:02 +02:00
Window.cpp LibGUI: Properly remove auto-destroyed child windows from reified_windows. 2020-05-02 20:27:07 +02:00
Window.h WindowServer+LibGUI: Automatically close child windows with parent 2020-05-02 01:29:55 +02:00
WindowServerConnection.cpp WindowServer+LibGUI: Support the 4th and 5th mouse buttons 2020-05-02 22:07:43 +02:00
WindowServerConnection.h WindowServer+LibGUI: Notify DisplayLinks at 60 fps no matter what 2020-04-22 00:07:48 +02:00
WindowType.h WindowServer: Add WindowType::Desktop 2020-04-18 21:10:16 +02:00