Skip to content

Latest commit

 

History

History
86 lines (60 loc) · 2.76 KB

README.md

File metadata and controls

86 lines (60 loc) · 2.76 KB

Table Editor

Jet Brains test task; making table editor with parser.

Done

  • Parsing
  • Functions
  • Reference to cells and cell ranges (only absolute cells)

Project structure


root/
| TableEditorApp.java - the main entry point for the app
| model/
|---- utils/
|     |---- CycleDetector.java  
|---- CellModel.java - the data and methods included
|---- TableModel.java - the data of the table

| parser/
|---- functions/
|     |---- Function - abstract functions
|     |---- SumFunction - functions inherited
|     |---- ConcatFunction - functions inherit
|     ...
|---- utils/
|     |---- GeneralUtils.java - utils for parser
|---- Evaluator.java - a wrapper class for parser.
|---- Lexer.java - lexer component. Handles tokenization.
|---- Parser.java - Main parser. Handles parsing and evaluation.
|---- Token.java - Token class
|---- TokenType.java - Token types.

| ui/
|---- utils/
|     |---- Popupmenu
|---- CustomTableCellEditor.java - Customized cell editor.
|---- CustomTableCellRenderer.java - Customized cell renderer.
|---- MainFrame.java - Wrapper for table.
|---- TablePanel.java - Table rendering UIs.

Functionalities

Brief overview of the functionalities and usage.

Functions.

A1:C2. Use cell Labels for range with colon. Support functions SUM, AVG, POW(arg, arg), COUNT, MIN, MAX, CONCAT.

functions

Copying/Pasting

CTRL+C -> CTRL + V

copying_pasting

Table editors

Mouse two on any cell.

table_editors

Parser.

My parser consist of Lexer and Parser. Lexer tokenizes the input and also has some sanitization for the expression. Parser is LL(1) parser implemented in recursive descent way.

Operator precendence.

Precedence Operator Description Associativity
1 : Cell Scope resolution Left-to-right
2 () Function call Left-to-right
3 + - Unary plus and minus Right-to-left
4 * / Multiplication, division Left-to-right
5 + - Addition, subtraction Left-to-right

As in the code, https://github.com/bilguudeiblgd/table-editor/blob/main/src/main/java/parser/Parser.java I use L1, L2, L3, L4, L5 functions which corresponds to this precendence.