mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-25 20:40:36 +03:00
Refactoring: spelling updates
This commit is contained in:
parent
6e12aff5c6
commit
87d3152e6c
37
.vscode/settings.json
vendored
37
.vscode/settings.json
vendored
|
@ -37,24 +37,56 @@
|
|||
"javascriptreact"
|
||||
],
|
||||
"cSpell.words": [
|
||||
"ablt",
|
||||
"accs",
|
||||
"actv",
|
||||
"ADJF",
|
||||
"ADJS",
|
||||
"ADVB",
|
||||
"Analyse",
|
||||
"Backquote",
|
||||
"BIGPR",
|
||||
"cctext",
|
||||
"CIHT",
|
||||
"clsx",
|
||||
"codemirror",
|
||||
"Constituenta",
|
||||
"csrftoken",
|
||||
"cstlist",
|
||||
"csttype",
|
||||
"datv",
|
||||
"Debool",
|
||||
"Decart",
|
||||
"EMPTYSET",
|
||||
"exteor",
|
||||
"femn",
|
||||
"filterset",
|
||||
"forceatlas",
|
||||
"futr",
|
||||
"Grammeme",
|
||||
"Grammemes",
|
||||
"GRND",
|
||||
"impr",
|
||||
"inan",
|
||||
"indc",
|
||||
"INFN",
|
||||
"Infr",
|
||||
"INTJ",
|
||||
"Keymap",
|
||||
"lezer",
|
||||
"Litr",
|
||||
"loct",
|
||||
"moprho",
|
||||
"nomn",
|
||||
"nooverlap",
|
||||
"NPRO",
|
||||
"NUMR",
|
||||
"perfectivity",
|
||||
"ponomarev",
|
||||
"PRCL",
|
||||
"PRTF",
|
||||
"PRTS",
|
||||
"pssv",
|
||||
"pyconcept",
|
||||
"pymorphy",
|
||||
"Quantor",
|
||||
|
@ -69,10 +101,13 @@
|
|||
"rstemplates",
|
||||
"SIDELIST",
|
||||
"signup",
|
||||
"Slng",
|
||||
"SMALLPR",
|
||||
"tanstack",
|
||||
"toastify",
|
||||
"tooltipic",
|
||||
"Viewset",
|
||||
"viewsets",
|
||||
"wordform",
|
||||
"Wordforms",
|
||||
"Булеан",
|
||||
|
@ -89,8 +124,10 @@
|
|||
"Родоструктурная",
|
||||
"Родоструктурное",
|
||||
"Синглетон",
|
||||
"твор",
|
||||
"Терминологизация",
|
||||
"Цермелло",
|
||||
"ЦИВТ",
|
||||
"Экстеор",
|
||||
"Экстеора",
|
||||
"Экстеоре"
|
||||
|
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2023 CIHT CONCEPT
|
||||
Copyright (c) 2024 CIHT CONCEPT
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -85,7 +85,7 @@ class TestConstituentaAPI(APITestCase):
|
|||
)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_update_resolved_norefs(self):
|
||||
def test_update_resolved_no_refs(self):
|
||||
data = {
|
||||
'term_raw': 'New term',
|
||||
'definition_raw': 'New def'
|
||||
|
@ -548,7 +548,7 @@ class TestRSFormViewset(APITestCase):
|
|||
schema = self.owned
|
||||
data = {'items': [1337]}
|
||||
response = self.client.patch(
|
||||
f'/api/rsforms/{schema.item.id}/cst-multidelete',
|
||||
f'/api/rsforms/{schema.item.id}/cst-delete-multiple',
|
||||
data=data, format='json'
|
||||
)
|
||||
self.assertEqual(response.status_code, 400)
|
||||
|
@ -557,7 +557,7 @@ class TestRSFormViewset(APITestCase):
|
|||
x2 = Constituenta.objects.create(schema=schema.item, alias='X2', cst_type='basic', order=2)
|
||||
data = {'items': [x1.id]}
|
||||
response = self.client.patch(
|
||||
f'/api/rsforms/{schema.item.id}/cst-multidelete',
|
||||
f'/api/rsforms/{schema.item.id}/cst-delete-multiple',
|
||||
data=data, format='json'
|
||||
)
|
||||
x2.refresh_from_db()
|
||||
|
@ -571,7 +571,7 @@ class TestRSFormViewset(APITestCase):
|
|||
x3 = Constituenta.objects.create(schema=self.unowned.item, alias='X1', cst_type='basic', order=1)
|
||||
data = {'items': [x3.id]}
|
||||
response = self.client.patch(
|
||||
f'/api/rsforms/{schema.item.id}/cst-multidelete',
|
||||
f'/api/rsforms/{schema.item.id}/cst-delete-multiple',
|
||||
data=data, format='json'
|
||||
)
|
||||
self.assertEqual(response.status_code, 400)
|
||||
|
@ -633,7 +633,7 @@ class TestRSFormViewset(APITestCase):
|
|||
|
||||
def test_load_trs(self):
|
||||
schema = self.owned
|
||||
schema.item.title = 'Testt11'
|
||||
schema.item.title = 'Test11'
|
||||
schema.item.save()
|
||||
x1 = Constituenta.objects.create(schema=schema.item, alias='X1', cst_type='basic', order=1)
|
||||
work_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
|
@ -645,14 +645,14 @@ class TestRSFormViewset(APITestCase):
|
|||
)
|
||||
schema.item.refresh_from_db()
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(schema.item.title, 'Testt11')
|
||||
self.assertEqual(schema.item.title, 'Test11')
|
||||
self.assertEqual(len(response.data['items']), 25)
|
||||
self.assertEqual(schema.constituents().count(), 25)
|
||||
self.assertFalse(Constituenta.objects.filter(pk=x1.id).exists())
|
||||
|
||||
def test_clone(self):
|
||||
item = self.owned.item
|
||||
item.title = 'Testt11'
|
||||
item.title = 'Test11'
|
||||
item.save()
|
||||
x1 = Constituenta.objects.create(schema=item, alias='X12', cst_type='basic', order=1)
|
||||
d1 = Constituenta.objects.create(schema=item, alias='D2', cst_type='term', order=1)
|
||||
|
|
|
@ -194,7 +194,7 @@ class RSFormViewSet(viewsets.GenericViewSet, generics.ListAPIView, generics.Retr
|
|||
|
||||
def get_permissions(self):
|
||||
''' Determine permission class. '''
|
||||
if self.action in ['load_trs', 'cst_create', 'cst_multidelete',
|
||||
if self.action in ['load_trs', 'cst_create', 'cst_delete_multiple',
|
||||
'reset_aliases', 'cst_rename']:
|
||||
permission_classes = [utils.ObjectOwnerOrAdmin]
|
||||
else:
|
||||
|
@ -262,8 +262,8 @@ class RSFormViewSet(viewsets.GenericViewSet, generics.ListAPIView, generics.Retr
|
|||
request=s.CstListSerializer,
|
||||
responses={c.HTTP_202_ACCEPTED: s.RSFormParseSerializer}
|
||||
)
|
||||
@action(detail=True, methods=['patch'], url_path='cst-multidelete')
|
||||
def cst_multidelete(self, request, pk):
|
||||
@action(detail=True, methods=['patch'], url_path='cst-delete-multiple')
|
||||
def cst_delete_multiple(self, request, pk):
|
||||
''' Endpoint: Delete multiple constituents. '''
|
||||
schema = self._get_schema()
|
||||
serializer = s.CstListSerializer(
|
||||
|
|
|
@ -25,7 +25,7 @@ function Footer() {
|
|||
<TextURL text='Экстеор' href='/manuals?topic=exteor' color='clr-footer'/>
|
||||
</div>
|
||||
<div>
|
||||
<p className='clr-footer'>© 2023 ЦИВТ КОНЦЕПТ</p>
|
||||
<p className='clr-footer'>© 2024 ЦИВТ КОНЦЕПТ</p>
|
||||
</div>
|
||||
</footer>);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Search new icons at https://reactsvgicons.com/
|
||||
|
||||
interface IconSVGProps {
|
||||
viewbox: string
|
||||
viewBox: string
|
||||
size?: string
|
||||
className?: string
|
||||
props?: React.SVGProps<SVGSVGElement>
|
||||
|
@ -13,14 +13,14 @@ export interface IconProps {
|
|||
className?: string
|
||||
}
|
||||
|
||||
function IconSVG({ viewbox, size = '1.5rem', className, props, children }: IconSVGProps) {
|
||||
function IconSVG({ viewBox, size = '1.5rem', className, props, children }: IconSVGProps) {
|
||||
return (
|
||||
<svg
|
||||
width={size}
|
||||
height={size}
|
||||
className={`w-[${size}] h-[${size}] ${className}`}
|
||||
fill='currentColor'
|
||||
viewBox={viewbox}
|
||||
viewBox={viewBox}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
|
@ -29,7 +29,7 @@ function IconSVG({ viewbox, size = '1.5rem', className, props, children }: IconS
|
|||
|
||||
export function EducationIcon(props: IconProps) {
|
||||
return (
|
||||
<IconSVG viewbox='0 0 20 20' {...props}>
|
||||
<IconSVG viewBox='0 0 20 20' {...props}>
|
||||
<path d='M3.33 8L10 12l10-6-10-6L0 6h10v2H3.33zM0 8v8l2-2.22V9.2L0 8zm10 12l-5-3-2-1.2v-6l7 4.2 7-4.2v6L10 20z' />
|
||||
</IconSVG>
|
||||
);
|
||||
|
@ -37,7 +37,7 @@ export function EducationIcon(props: IconProps) {
|
|||
|
||||
export function InDoorIcon(props: IconProps) {
|
||||
return (
|
||||
<IconSVG viewbox='0 0 24 24' {...props}>
|
||||
<IconSVG viewBox='0 0 24 24' {...props}>
|
||||
<path fill='none' d='M0 0h24v24H0z' />
|
||||
<path d='M10 11H4V3a1 1 0 011-1h14a1 1 0 011 1v18a1 1 0 01-1 1H5a1 1 0 01-1-1v-8h6v3l5-4-5-4v3z' />
|
||||
</IconSVG>
|
||||
|
|
|
@ -4,11 +4,11 @@ import { Decoration, EditorView } from '@codemirror/view';
|
|||
import { bracketsDarkT, bracketsLightT } from '@/utils/color';
|
||||
|
||||
const matchingMark = Decoration.mark({class: 'cc-matchingBracket'});
|
||||
const nonmatchingMark = Decoration.mark({class: 'cc-nonmatchingBracket'});
|
||||
const nonMatchingMark = Decoration.mark({class: 'cc-nonmatchingBracket'});
|
||||
|
||||
function bracketRender(match: MatchResult) {
|
||||
const decorations = [];
|
||||
const mark = match.matched ? matchingMark : nonmatchingMark;
|
||||
const mark = match.matched ? matchingMark : nonMatchingMark;
|
||||
decorations.push(mark.range(match.start.from, match.start.to));
|
||||
if (match.end) {
|
||||
decorations.push(mark.range(match.end.from, match.end.to));
|
||||
|
|
|
@ -28,9 +28,6 @@ export function getSymbolSubstitute(keyCode: string, shiftPressed: boolean): str
|
|||
switch (keyCode) {
|
||||
case 'Backquote': return '∀';
|
||||
|
||||
// qwerty = μωερτπ
|
||||
// asdfgh = ασδφγλ
|
||||
// zxcvbn = ζξψθβη
|
||||
case 'KeyQ': return 'μ';
|
||||
case 'KeyW': return 'ω';
|
||||
case 'KeyE': return 'ε';
|
||||
|
@ -52,7 +49,6 @@ export function getSymbolSubstitute(keyCode: string, shiftPressed: boolean): str
|
|||
case 'KeyB': return 'β';
|
||||
case 'KeyN': return 'η';
|
||||
|
||||
// punctuation
|
||||
case 'BracketLeft': return '[';
|
||||
case 'BracketRight': return ']';
|
||||
case 'Comma': return ',';
|
||||
|
@ -110,7 +106,7 @@ export class RSTextWrapper extends CodeMirrorWrapper {
|
|||
case TokenID.BOOL: this.envelopeWith('bool(', ')'); return true;
|
||||
case TokenID.DEBOOL: this.envelopeWith('debool(', ')'); return true;
|
||||
|
||||
case TokenID.PUNC_PL: {
|
||||
case TokenID.PUNCTUATION_PL: {
|
||||
this.envelopeWith('(', ')');
|
||||
this.ref.view.dispatch({
|
||||
selection: {
|
||||
|
@ -119,7 +115,7 @@ export class RSTextWrapper extends CodeMirrorWrapper {
|
|||
});
|
||||
return true;
|
||||
}
|
||||
case TokenID.PUNC_SL: {
|
||||
case TokenID.PUNCTUATION_SL: {
|
||||
this.envelopeWith('[', ']');
|
||||
if (hasSelection) {
|
||||
this.ref.view.dispatch({
|
||||
|
@ -141,30 +137,30 @@ export class RSTextWrapper extends CodeMirrorWrapper {
|
|||
}
|
||||
|
||||
case TokenID.DECART: this.replaceWith('×'); return true;
|
||||
case TokenID.FORALL: this.replaceWith('∀'); return true;
|
||||
case TokenID.EXISTS: this.replaceWith('∃'); return true;
|
||||
case TokenID.IN: this.replaceWith('∈'); return true;
|
||||
case TokenID.NOTIN: this.replaceWith('∉'); return true;
|
||||
case TokenID.OR: this.replaceWith('∨'); return true;
|
||||
case TokenID.AND: this.replaceWith('&'); return true;
|
||||
case TokenID.QUANTOR_UNIVERSAL: this.replaceWith('∀'); return true;
|
||||
case TokenID.QUANTOR_EXISTS: this.replaceWith('∃'); return true;
|
||||
case TokenID.SET_IN: this.replaceWith('∈'); return true;
|
||||
case TokenID.SET_NOT_IN: this.replaceWith('∉'); return true;
|
||||
case TokenID.LOGIC_OR: this.replaceWith('∨'); return true;
|
||||
case TokenID.LOGIC_AND: this.replaceWith('&'); return true;
|
||||
case TokenID.SUBSET_OR_EQ: this.replaceWith('⊆'); return true;
|
||||
case TokenID.IMPLICATION: this.replaceWith('⇒'); return true;
|
||||
case TokenID.INTERSECTION: this.replaceWith('∩'); return true;
|
||||
case TokenID.UNION: this.replaceWith('∪'); return true;
|
||||
case TokenID.LOGIC_IMPLICATION: this.replaceWith('⇒'); return true;
|
||||
case TokenID.SET_INTERSECTION: this.replaceWith('∩'); return true;
|
||||
case TokenID.SET_UNION: this.replaceWith('∪'); return true;
|
||||
case TokenID.SET_MINUS: this.replaceWith('\\'); return true;
|
||||
case TokenID.SYMMINUS: this.replaceWith('∆'); return true;
|
||||
case TokenID.SET_SYMMETRIC_MINUS: this.replaceWith('∆'); return true;
|
||||
case TokenID.LIT_EMPTYSET: this.replaceWith('∅'); return true;
|
||||
case TokenID.LIT_INTSET: this.replaceWith('Z'); return true;
|
||||
case TokenID.LIT_WHOLE_NUMBERS: this.replaceWith('Z'); return true;
|
||||
case TokenID.SUBSET: this.replaceWith('⊂'); return true;
|
||||
case TokenID.NOTSUBSET: this.replaceWith('⊄'); return true;
|
||||
case TokenID.NOT_SUBSET: this.replaceWith('⊄'); return true;
|
||||
case TokenID.EQUAL: this.replaceWith('='); return true;
|
||||
case TokenID.NOTEQUAL: this.replaceWith('≠'); return true;
|
||||
case TokenID.NOT: this.replaceWith('¬'); return true;
|
||||
case TokenID.EQUIVALENT: this.replaceWith('⇔'); return true;
|
||||
case TokenID.LOGIC_NOT: this.replaceWith('¬'); return true;
|
||||
case TokenID.LOGIC_EQUIVALENT: this.replaceWith('⇔'); return true;
|
||||
case TokenID.GREATER_OR_EQ: this.replaceWith('≥'); return true;
|
||||
case TokenID.LESSER_OR_EQ: this.replaceWith('≤'); return true;
|
||||
case TokenID.PUNC_ASSIGN: this.replaceWith(':='); return true;
|
||||
case TokenID.PUNC_ITERATE: this.replaceWith(':∈'); return true;
|
||||
case TokenID.PUNCTUATION_ASSIGN: this.replaceWith(':='); return true;
|
||||
case TokenID.PUNCTUATION_ITERATE: this.replaceWith(':∈'); return true;
|
||||
case TokenID.MULTIPLY: this.replaceWith('*'); return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -173,57 +169,47 @@ export class RSTextWrapper extends CodeMirrorWrapper {
|
|||
processAltKey(keyCode: string, shiftPressed: boolean): boolean {
|
||||
if (shiftPressed) {
|
||||
switch (keyCode) {
|
||||
// qwert
|
||||
// asdfg
|
||||
// zxcvb
|
||||
case 'KeyE': return this.insertToken(TokenID.DECART);
|
||||
|
||||
// `123456
|
||||
// ~!@#$%^
|
||||
case 'Backquote': return this.insertToken(TokenID.NOTEQUAL);
|
||||
case 'Digit1': return this.insertToken(TokenID.NOTIN); // !
|
||||
case 'Digit2': return this.insertToken(TokenID.NOTSUBSET); // @
|
||||
case 'Digit3': return this.insertToken(TokenID.OR); // #
|
||||
case 'Digit4': return this.insertToken(TokenID.EQUIVALENT); // $
|
||||
case 'Digit5': return this.insertToken(TokenID.SYMMINUS); // %
|
||||
case 'Digit6': return this.insertToken(TokenID.PUNC_ASSIGN); // ^
|
||||
case 'Digit1': return this.insertToken(TokenID.SET_NOT_IN); // !
|
||||
case 'Digit2': return this.insertToken(TokenID.NOT_SUBSET); // @
|
||||
case 'Digit3': return this.insertToken(TokenID.LOGIC_OR); // #
|
||||
case 'Digit4': return this.insertToken(TokenID.LOGIC_EQUIVALENT); // $
|
||||
case 'Digit5': return this.insertToken(TokenID.SET_SYMMETRIC_MINUS); // %
|
||||
case 'Digit6': return this.insertToken(TokenID.PUNCTUATION_ASSIGN); // ^
|
||||
case 'Digit7': return this.insertToken(TokenID.GREATER_OR_EQ); // &
|
||||
case 'Digit8': return this.insertToken(TokenID.LESSER_OR_EQ); // *
|
||||
case 'Digit9': return this.insertToken(TokenID.PUNC_PL); // (
|
||||
case 'Digit9': return this.insertToken(TokenID.PUNCTUATION_PL); // (
|
||||
}
|
||||
} else {
|
||||
switch (keyCode) {
|
||||
// qwert
|
||||
// asdfg
|
||||
// zxcvb
|
||||
case 'KeyQ': return this.insertToken(TokenID.BIGPR);
|
||||
case 'KeyW': return this.insertToken(TokenID.SMALLPR);
|
||||
case 'KeyE': return this.insertToken(TokenID.BOOLEAN);
|
||||
case 'KeyR': return this.insertToken(TokenID.REDUCE);
|
||||
case 'KeyT': return this.insertToken(TokenID.NT_RECURSIVE_FULL);
|
||||
case 'KeyA': return this.insertToken(TokenID.INTERSECTION);
|
||||
case 'KeyS': return this.insertToken(TokenID.UNION);
|
||||
case 'KeyA': return this.insertToken(TokenID.SET_INTERSECTION);
|
||||
case 'KeyS': return this.insertToken(TokenID.SET_UNION);
|
||||
case 'KeyD': return this.insertToken(TokenID.NT_DECLARATIVE_EXPR);
|
||||
case 'KeyF': return this.insertToken(TokenID.FILTER);
|
||||
case 'KeyG': return this.insertToken(TokenID.NT_IMPERATIVE_EXPR);
|
||||
case 'KeyZ': return this.insertToken(TokenID.LIT_INTSET);
|
||||
case 'KeyZ': return this.insertToken(TokenID.LIT_WHOLE_NUMBERS);
|
||||
case 'KeyX': return this.insertToken(TokenID.LIT_EMPTYSET);
|
||||
case 'KeyC': return this.insertToken(TokenID.CARD);
|
||||
case 'KeyV': return this.insertToken(TokenID.DEBOOL);
|
||||
case 'KeyB': return this.insertToken(TokenID.BOOL);
|
||||
|
||||
// `123456
|
||||
// ~!@#$%^
|
||||
case 'Backquote': return this.insertToken(TokenID.NOT);
|
||||
case 'Digit1': return this.insertToken(TokenID.IN);
|
||||
case 'Backquote': return this.insertToken(TokenID.LOGIC_NOT);
|
||||
case 'Digit1': return this.insertToken(TokenID.SET_IN);
|
||||
case 'Digit2': return this.insertToken(TokenID.SUBSET_OR_EQ);
|
||||
case 'Digit3': return this.insertToken(TokenID.AND);
|
||||
case 'Digit4': return this.insertToken(TokenID.IMPLICATION);
|
||||
case 'Digit3': return this.insertToken(TokenID.LOGIC_AND);
|
||||
case 'Digit4': return this.insertToken(TokenID.LOGIC_IMPLICATION);
|
||||
case 'Digit5': return this.insertToken(TokenID.SET_MINUS);
|
||||
case 'Digit6': return this.insertToken(TokenID.PUNC_ITERATE);
|
||||
case 'Digit6': return this.insertToken(TokenID.PUNCTUATION_ITERATE);
|
||||
case 'Digit7': return this.insertToken(TokenID.SUBSET);
|
||||
case 'Digit8': return this.insertToken(TokenID.MULTIPLY);
|
||||
case 'BracketLeft': return this.insertToken(TokenID.PUNC_SL);
|
||||
case 'BracketLeft': return this.insertToken(TokenID.PUNCTUATION_SL);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -16,7 +16,7 @@ interface ConstituentaPickerProps {
|
|||
data?: IConstituenta[]
|
||||
rows?: number
|
||||
|
||||
prefilterFunc?: (cst: IConstituenta) => boolean
|
||||
onBeginFilter?: (cst: IConstituenta) => boolean
|
||||
describeFunc?: (cst: IConstituenta) => string
|
||||
matchFunc?: (cst: IConstituenta, filter: string) => boolean
|
||||
|
||||
|
@ -32,7 +32,7 @@ function ConstituentaPicker({
|
|||
prefixID = prefixes.cst_list,
|
||||
describeFunc = describeConstituenta,
|
||||
matchFunc = (cst, filter) => matchConstituenta(cst, filter, CstMatchMode.ALL),
|
||||
prefilterFunc,
|
||||
onBeginFilter,
|
||||
onSelectValue
|
||||
} : ConstituentaPickerProps) {
|
||||
const { colors } = useConceptTheme();
|
||||
|
@ -44,7 +44,7 @@ function ConstituentaPicker({
|
|||
if (!data) {
|
||||
setFilteredData([]);
|
||||
} else {
|
||||
const newData = prefilterFunc ? data.filter(prefilterFunc) : data;
|
||||
const newData = onBeginFilter ? data.filter(onBeginFilter) : data;
|
||||
if (filterText) {
|
||||
setFilteredData(newData.filter(cst => matchFunc(cst, filterText)));
|
||||
} else {
|
||||
|
@ -52,7 +52,7 @@ function ConstituentaPicker({
|
|||
}
|
||||
}
|
||||
|
||||
}, [data, filterText, matchFunc, prefilterFunc]);
|
||||
}, [data, filterText, matchFunc, onBeginFilter]);
|
||||
|
||||
const columns = useMemo(
|
||||
() => [
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useEffect, useState } from 'react';
|
|||
import SelectMulti, { SelectMultiProps } from '@/components/Common/SelectMulti';
|
||||
import { Grammeme } from '@/models/language';
|
||||
import { getCompatibleGrams } from '@/models/languageAPI';
|
||||
import { compareGrammemeOptions,IGrammemeOption, SelectorGrammems } from '@/utils/selectors';
|
||||
import { compareGrammemeOptions,IGrammemeOption, SelectorGrammemes } from '@/utils/selectors';
|
||||
|
||||
interface SelectGrammemeProps extends
|
||||
Omit<SelectMultiProps<IGrammemeOption>, 'value' | 'onChange'> {
|
||||
|
@ -26,7 +26,7 @@ function SelectGrammeme({
|
|||
.filter(data => Object.values(Grammeme).includes(data.value as Grammeme))
|
||||
.map(data => data.value as Grammeme)
|
||||
);
|
||||
setOptions(SelectorGrammems.filter(({value}) => compatible.includes(value as Grammeme)));
|
||||
setOptions(SelectorGrammemes.filter(({value}) => compatible.includes(value as Grammeme)));
|
||||
}, [value]);
|
||||
|
||||
return (
|
||||
|
|
|
@ -13,7 +13,7 @@ import { CstMatchMode } from '@/models/miscellaneous';
|
|||
import { IConstituenta } from '@/models/rsform';
|
||||
import { matchConstituenta } from '@/models/rsformAPI';
|
||||
import { prefixes } from '@/utils/constants';
|
||||
import { IGrammemeOption, SelectorGrammems } from '@/utils/selectors';
|
||||
import { IGrammemeOption, SelectorGrammemes } from '@/utils/selectors';
|
||||
|
||||
import { IReferenceInputState } from './DlgEditReference';
|
||||
import SelectWordForm from './SelectWordForm';
|
||||
|
@ -38,7 +38,7 @@ function EntityTab({ initial, items, setIsValid, setReference }: EntityTabProps)
|
|||
const ref = parseEntityReference(initial.refRaw);
|
||||
setAlias(ref.entity);
|
||||
const grams = parseGrammemes(ref.form);
|
||||
setSelectedGrams(SelectorGrammems.filter(data => grams.includes(data.value)));
|
||||
setSelectedGrams(SelectorGrammemes.filter(data => grams.includes(data.value)));
|
||||
}
|
||||
}, [initial, items]);
|
||||
|
||||
|
@ -70,7 +70,7 @@ function EntityTab({ initial, items, setIsValid, setReference }: EntityTabProps)
|
|||
prefixID={prefixes.cst_modal_list}
|
||||
describeFunc={cst => cst.term_resolved}
|
||||
matchFunc={(cst, filter) => matchConstituenta(cst, filter, CstMatchMode.TERM)}
|
||||
prefilterFunc={cst => cst.term_resolved !== ''}
|
||||
onBeginFilter={cst => cst.term_resolved !== ''}
|
||||
rows={8}
|
||||
/>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import { useCallback } from 'react';
|
|||
|
||||
import { Grammeme } from '@/models/language';
|
||||
import { prefixes } from '@/utils/constants';
|
||||
import { IGrammemeOption, PremadeWordForms, SelectorGrammems } from '@/utils/selectors';
|
||||
import { IGrammemeOption, DefaultWordForms, SelectorGrammemes } from '@/utils/selectors';
|
||||
|
||||
import WordformButton from './WordformButton';
|
||||
|
||||
|
@ -16,12 +16,12 @@ interface SelectWordFormProps {
|
|||
function SelectWordForm({ selected, setSelected }: SelectWordFormProps) {
|
||||
const handleSelect = useCallback(
|
||||
(grams: Grammeme[]) => {
|
||||
setSelected(SelectorGrammems.filter(({value}) => grams.includes(value as Grammeme)));
|
||||
setSelected(SelectorGrammemes.filter(({value}) => grams.includes(value as Grammeme)));
|
||||
}, [setSelected]);
|
||||
|
||||
return (
|
||||
<div className='text-sm'>
|
||||
{PremadeWordForms.slice(0, 12).map(
|
||||
{DefaultWordForms.slice(0, 12).map(
|
||||
(data, index) =>
|
||||
<WordformButton key={`${prefixes.wordform_list}${index}`}
|
||||
text={data.text} example={data.example} grams={data.grams}
|
||||
|
|
|
@ -16,7 +16,7 @@ import { Grammeme, ITextRequest, IWordForm, IWordFormPlain } from '@/models/lang
|
|||
import { parseGrammemes, wordFormEquals } from '@/models/languageAPI';
|
||||
import { HelpTopic } from '@/models/miscellaneous';
|
||||
import { IConstituenta, TermForm } from '@/models/rsform';
|
||||
import { IGrammemeOption, SelectorGrammemesList, SelectorGrammems } from '@/utils/selectors';
|
||||
import { IGrammemeOption, SelectorGrammemes,SelectorGrammemesList } from '@/utils/selectors';
|
||||
|
||||
import WordFormsTable from './WordFormsTable';
|
||||
|
||||
|
@ -71,7 +71,7 @@ function DlgEditWordForms({ hideWindow, target, onSave }: DlgEditWordFormsProps)
|
|||
|
||||
function handleSelectForm(form: IWordForm) {
|
||||
setInputText(form.text);
|
||||
setInputGrams(SelectorGrammems.filter(gram => form.grams.find(test => test === gram.value)));
|
||||
setInputGrams(SelectorGrammemes.filter(gram => form.grams.find(test => test === gram.value)));
|
||||
}
|
||||
|
||||
function handleInflect() {
|
||||
|
@ -88,7 +88,7 @@ function DlgEditWordForms({ hideWindow, target, onSave }: DlgEditWordFormsProps)
|
|||
}
|
||||
textProcessor.parse(data, response => {
|
||||
const grams = parseGrammemes(response.result);
|
||||
setInputGrams(SelectorGrammems.filter(gram => grams.find(test => test === gram.value)));
|
||||
setInputGrams(SelectorGrammemes.filter(gram => grams.find(test => test === gram.value)));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import { RSErrorType } from '@/models/rslang';
|
|||
import { DataCallback, postCheckExpression } from '@/utils/backendAPI';
|
||||
import { getCstExpressionPrefix } from '@/utils/misc';
|
||||
|
||||
const LOGIC_TYPIIFCATION = 'LOGIC';
|
||||
const LOGIC_TYPIFICATION = 'LOGIC';
|
||||
|
||||
function useCheckExpression({ schema }: { schema?: IRSForm }) {
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
@ -18,7 +18,11 @@ function useCheckExpression({ schema }: { schema?: IRSForm }) {
|
|||
|
||||
const resetParse = useCallback(() => setParseData(undefined), []);
|
||||
|
||||
function checkExpression(expression: string, activeCst?: IConstituenta, onSuccess?: DataCallback<IExpressionParse>) {
|
||||
function checkExpression(
|
||||
expression: string,
|
||||
activeCst?: IConstituenta,
|
||||
onSuccess?: DataCallback<IExpressionParse>
|
||||
) {
|
||||
setError(undefined);
|
||||
postCheckExpression(String(schema!.id), {
|
||||
data: { expression: expression },
|
||||
|
@ -41,24 +45,23 @@ function useCheckExpression({ schema }: { schema?: IRSForm }) {
|
|||
export default useCheckExpression;
|
||||
|
||||
// ===== Internals ========
|
||||
|
||||
function checkTypeConsistency(type: CstType, typification: string, args: IArgumentInfo[]): boolean {
|
||||
switch (type) {
|
||||
case CstType.BASE:
|
||||
case CstType.CONSTANT:
|
||||
case CstType.STRUCTURED:
|
||||
case CstType.TERM:
|
||||
return typification !== LOGIC_TYPIIFCATION && args.length === 0;
|
||||
return typification !== LOGIC_TYPIFICATION && args.length === 0;
|
||||
|
||||
case CstType.AXIOM:
|
||||
case CstType.THEOREM:
|
||||
return typification === LOGIC_TYPIIFCATION && args.length === 0;
|
||||
return typification === LOGIC_TYPIFICATION && args.length === 0;
|
||||
|
||||
case CstType.FUNCTION:
|
||||
return typification !== LOGIC_TYPIIFCATION && args.length !== 0;
|
||||
return typification !== LOGIC_TYPIFICATION && args.length !== 0;
|
||||
|
||||
case CstType.PREDICATE:
|
||||
return typification === LOGIC_TYPIIFCATION && args.length !== 0;
|
||||
return typification === LOGIC_TYPIFICATION && args.length !== 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,6 +78,7 @@ function adjustResults(parse: IExpressionParse, emptyExpression: boolean, cstTyp
|
|||
params: [],
|
||||
position: 0
|
||||
});
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (emptyExpression) {
|
||||
|
@ -85,6 +89,7 @@ function adjustResults(parse: IExpressionParse, emptyExpression: boolean, cstTyp
|
|||
params: [],
|
||||
position: 0
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!checkTypeConsistency(cstType, parse.typification, parse.args)) {
|
||||
|
|
|
@ -106,10 +106,10 @@ export enum TokenID {
|
|||
ID_PREDICATE,
|
||||
ID_RADICAL,
|
||||
LIT_INTEGER,
|
||||
LIT_INTSET,
|
||||
LIT_WHOLE_NUMBERS,
|
||||
LIT_EMPTYSET,
|
||||
|
||||
// Aithmetic
|
||||
// Arithmetic
|
||||
PLUS,
|
||||
MINUS,
|
||||
MULTIPLY,
|
||||
|
@ -125,27 +125,27 @@ export enum TokenID {
|
|||
NOTEQUAL,
|
||||
|
||||
// Logic predicate symbols
|
||||
FORALL,
|
||||
EXISTS,
|
||||
NOT,
|
||||
EQUIVALENT,
|
||||
IMPLICATION,
|
||||
OR,
|
||||
AND,
|
||||
QUANTOR_UNIVERSAL,
|
||||
QUANTOR_EXISTS,
|
||||
LOGIC_NOT,
|
||||
LOGIC_EQUIVALENT,
|
||||
LOGIC_IMPLICATION,
|
||||
LOGIC_OR,
|
||||
LOGIC_AND,
|
||||
|
||||
// Set theory predicate symbols
|
||||
IN,
|
||||
NOTIN,
|
||||
SET_IN,
|
||||
SET_NOT_IN,
|
||||
SUBSET,
|
||||
SUBSET_OR_EQ,
|
||||
NOTSUBSET,
|
||||
NOT_SUBSET,
|
||||
|
||||
// Set theory operators
|
||||
DECART,
|
||||
UNION,
|
||||
INTERSECTION,
|
||||
SET_UNION,
|
||||
SET_INTERSECTION,
|
||||
SET_MINUS,
|
||||
SYMMINUS,
|
||||
SET_SYMMETRIC_MINUS,
|
||||
BOOLEAN,
|
||||
|
||||
// Structure operations
|
||||
|
@ -163,19 +163,19 @@ export enum TokenID {
|
|||
IMPERATIVE,
|
||||
|
||||
// Punctuation
|
||||
PUNC_DEFINE,
|
||||
PUNC_STRUCT,
|
||||
PUNC_ASSIGN,
|
||||
PUNC_ITERATE,
|
||||
PUNC_PL,
|
||||
PUNC_PR,
|
||||
PUNC_CL,
|
||||
PUNC_CR,
|
||||
PUNC_SL,
|
||||
PUNC_SR,
|
||||
PUNC_BAR,
|
||||
PUNC_COMMA,
|
||||
PUNC_SEMICOLON,
|
||||
PUNCTUATION_DEFINE,
|
||||
PUNCTUATION_STRUCT,
|
||||
PUNCTUATION_ASSIGN,
|
||||
PUNCTUATION_ITERATE,
|
||||
PUNCTUATION_PL,
|
||||
PUNCTUATION_PR,
|
||||
PUNCTUATION_CL,
|
||||
PUNCTUATION_CR,
|
||||
PUNCTUATION_SL,
|
||||
PUNCTUATION_SR,
|
||||
PUNCTUATION_BAR,
|
||||
PUNCTUATION_COMMA,
|
||||
PUNCTUATION_SEMICOLON,
|
||||
|
||||
// ======= Non-terminal tokens =========
|
||||
NT_ENUM_DECL,
|
||||
|
|
|
@ -21,34 +21,34 @@ const MAIN_FIRST_ROW: TokenID[] = [
|
|||
|
||||
const MAIN_SECOND_ROW: TokenID[] = [
|
||||
TokenID.BOOLEAN,
|
||||
TokenID.PUNC_PL,
|
||||
TokenID.INTERSECTION,
|
||||
TokenID.PUNCTUATION_PL,
|
||||
TokenID.SET_INTERSECTION,
|
||||
TokenID.LIT_EMPTYSET,
|
||||
TokenID.FORALL,
|
||||
TokenID.NOT,
|
||||
TokenID.IN,
|
||||
TokenID.QUANTOR_UNIVERSAL,
|
||||
TokenID.LOGIC_NOT,
|
||||
TokenID.SET_IN,
|
||||
TokenID.SUBSET_OR_EQ,
|
||||
TokenID.AND,
|
||||
TokenID.IMPLICATION,
|
||||
TokenID.LOGIC_AND,
|
||||
TokenID.LOGIC_IMPLICATION,
|
||||
TokenID.SET_MINUS,
|
||||
TokenID.PUNC_ITERATE,
|
||||
TokenID.PUNCTUATION_ITERATE,
|
||||
TokenID.SUBSET,
|
||||
TokenID.DEBOOL
|
||||
];
|
||||
|
||||
const MAIN_THIRD_ROW: TokenID[] = [
|
||||
TokenID.DECART,
|
||||
TokenID.PUNC_SL,
|
||||
TokenID.UNION,
|
||||
TokenID.LIT_INTSET,
|
||||
TokenID.EXISTS,
|
||||
TokenID.PUNCTUATION_SL,
|
||||
TokenID.SET_UNION,
|
||||
TokenID.LIT_WHOLE_NUMBERS,
|
||||
TokenID.QUANTOR_EXISTS,
|
||||
TokenID.NOTEQUAL,
|
||||
TokenID.NOTIN,
|
||||
TokenID.NOTSUBSET,
|
||||
TokenID.OR,
|
||||
TokenID.EQUIVALENT,
|
||||
TokenID.SYMMINUS,
|
||||
TokenID.PUNC_ASSIGN,
|
||||
TokenID.SET_NOT_IN,
|
||||
TokenID.NOT_SUBSET,
|
||||
TokenID.LOGIC_OR,
|
||||
TokenID.LOGIC_EQUIVALENT,
|
||||
TokenID.SET_SYMMETRIC_MINUS,
|
||||
TokenID.PUNCTUATION_ASSIGN,
|
||||
TokenID.EQUAL,
|
||||
TokenID.GREATER_OR_EQ,
|
||||
TokenID.LESSER_OR_EQ
|
||||
|
|
|
@ -52,7 +52,7 @@ function RSFormToolbar({
|
|||
onClick={onDownload}
|
||||
/>
|
||||
<MiniButton
|
||||
title={'Отслеживание ' + (isSubscribed ? 'включено' : 'выключено')}
|
||||
title={`Отслеживание ${isSubscribed ? 'включено' : 'выключено'}`}
|
||||
disabled={anonymous || processing}
|
||||
icon={isSubscribed
|
||||
? <FiBell size='1.25rem' className='clr-text-primary' />
|
||||
|
|
|
@ -45,7 +45,7 @@ describe('Testing Graph editing', () => {
|
|||
expect(graph.hasEdge(4, 1)).toBeFalsy();
|
||||
});
|
||||
|
||||
test('folding node redirectes edges', () => {
|
||||
test('folding node redirects edges', () => {
|
||||
const graph = new Graph([[1, 3], [2, 3], [3, 4], [3, 5], [3, 3]]);
|
||||
graph.foldNode(3);
|
||||
expect(graph.hasNode(3)).toBeFalsy();
|
||||
|
@ -73,7 +73,7 @@ describe('Testing Graph editing', () => {
|
|||
describe('Testing Graph sort', () => {
|
||||
test('topological order', () => {
|
||||
const graph = new Graph([[9, 1], [9, 2], [2, 1], [4, 3], [5, 9]]);
|
||||
expect(graph.tolopogicalOrder()).toStrictEqual([5, 4, 3, 9, 2, 1]);
|
||||
expect(graph.topologicalOrder()).toStrictEqual([5, 4, 3, 9, 2, 1]);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -202,7 +202,7 @@ export class Graph {
|
|||
return result;
|
||||
}
|
||||
|
||||
tolopogicalOrder(): number[] {
|
||||
topologicalOrder(): number[] {
|
||||
const result: number[] = [];
|
||||
const marked = new Map<number, boolean>();
|
||||
const toVisit: number[] = [];
|
||||
|
@ -235,7 +235,7 @@ export class Graph {
|
|||
}
|
||||
|
||||
transitiveReduction() {
|
||||
const order = this.tolopogicalOrder();
|
||||
const order = this.topologicalOrder();
|
||||
const marked = new Map<number, boolean>();
|
||||
order.forEach(nodeID => {
|
||||
if (marked.get(nodeID)) {
|
||||
|
|
|
@ -203,7 +203,7 @@ export function deleteLibraryItem(target: string, request: FrontAction) {
|
|||
|
||||
export function postClaimLibraryItem(target: string, request: FrontPull<ILibraryItem>) {
|
||||
AxiosPost({
|
||||
title: `Claim on LibrartyItem id=${target}`,
|
||||
title: `Claim on LibraryItem id=${target}`,
|
||||
endpoint: `/api/library/${target}/claim`,
|
||||
request: request
|
||||
});
|
||||
|
@ -211,7 +211,7 @@ export function postClaimLibraryItem(target: string, request: FrontPull<ILibrary
|
|||
|
||||
export function postSubscribe(target: string, request: FrontAction) {
|
||||
AxiosPost({
|
||||
title: `Subscribe to LibrartyItem id=${target}`,
|
||||
title: `Subscribe to LibraryItem id=${target}`,
|
||||
endpoint: `/api/library/${target}/subscribe`,
|
||||
request: request
|
||||
});
|
||||
|
@ -245,7 +245,7 @@ export function postNewConstituenta(schema: string, request: FrontExchange<ICstC
|
|||
export function patchDeleteConstituenta(schema: string, request: FrontExchange<IConstituentaList, IRSFormData>) {
|
||||
AxiosPatch({
|
||||
title: `Delete Constituents for RSForm id=${schema}: ${request.data.items.map(item => String(item)).join(' ')}`,
|
||||
endpoint: `/api/rsforms/${schema}/cst-multidelete`,
|
||||
endpoint: `/api/rsforms/${schema}/cst-delete-multiple`,
|
||||
request: request
|
||||
});
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ export interface IColorTheme {
|
|||
fgDisabled: string
|
||||
fgWarning: string
|
||||
|
||||
// Hightlight syntax accents
|
||||
// Highlight syntax accents
|
||||
bgRed: string
|
||||
bgGreen: string
|
||||
bgBlue: string
|
||||
|
@ -64,7 +64,7 @@ export const lightT: IColorTheme = {
|
|||
fgDisabled: 'var(--cl-fg-80)',
|
||||
fgWarning: 'var(--cl-red-fg-100)',
|
||||
|
||||
// Hightlight syntax accents
|
||||
// Highlight syntax accents
|
||||
bgRed: 'hsl(000, 100%, 089%)',
|
||||
bgGreen: 'hsl(100, 100%, 075%)',
|
||||
bgBlue: 'hsl(235, 080%, 087%)',
|
||||
|
@ -100,7 +100,7 @@ export const darkT: IColorTheme = {
|
|||
fgDisabled: 'var(--cd-fg-80)',
|
||||
fgWarning: 'var(--cd-red-fg-100)',
|
||||
|
||||
// Hightlight syntax accents
|
||||
// Highlight syntax accents
|
||||
bgRed: 'hsl(000, 080%, 037%)',
|
||||
bgGreen: 'hsl(100, 080%, 025%)',
|
||||
bgBlue: 'hsl(235, 054%, 049%)',
|
||||
|
@ -303,8 +303,8 @@ export const bracketsDarkT = {
|
|||
*/
|
||||
export function colorBgSyntaxTree(node: ISyntaxTreeNode, colors: IColorTheme): string {
|
||||
switch (node.typeID) {
|
||||
case TokenID.PUNC_DEFINE:
|
||||
case TokenID.PUNC_STRUCT:
|
||||
case TokenID.PUNCTUATION_DEFINE:
|
||||
case TokenID.PUNCTUATION_STRUCT:
|
||||
case TokenID.ID_LOCAL:
|
||||
return colors.bgGreen;
|
||||
|
||||
|
@ -314,27 +314,27 @@ export function colorBgSyntaxTree(node: ISyntaxTreeNode, colors: IColorTheme): s
|
|||
case TokenID.ID_RADICAL:
|
||||
case TokenID.LIT_INTEGER:
|
||||
case TokenID.LIT_EMPTYSET:
|
||||
case TokenID.LIT_INTSET:
|
||||
case TokenID.LIT_WHOLE_NUMBERS:
|
||||
return colors.bgTeal;
|
||||
|
||||
case TokenID.FORALL:
|
||||
case TokenID.EXISTS:
|
||||
case TokenID.NOT:
|
||||
case TokenID.AND:
|
||||
case TokenID.OR:
|
||||
case TokenID.IMPLICATION:
|
||||
case TokenID.EQUIVALENT:
|
||||
case TokenID.QUANTOR_UNIVERSAL:
|
||||
case TokenID.QUANTOR_EXISTS:
|
||||
case TokenID.LOGIC_NOT:
|
||||
case TokenID.LOGIC_AND:
|
||||
case TokenID.LOGIC_OR:
|
||||
case TokenID.LOGIC_IMPLICATION:
|
||||
case TokenID.LOGIC_EQUIVALENT:
|
||||
case TokenID.GREATER:
|
||||
case TokenID.LESSER:
|
||||
case TokenID.EQUAL:
|
||||
case TokenID.NOTEQUAL:
|
||||
case TokenID.GREATER_OR_EQ:
|
||||
case TokenID.LESSER_OR_EQ:
|
||||
case TokenID.IN:
|
||||
case TokenID.NOTIN:
|
||||
case TokenID.SET_IN:
|
||||
case TokenID.SET_NOT_IN:
|
||||
case TokenID.SUBSET_OR_EQ:
|
||||
case TokenID.SUBSET:
|
||||
case TokenID.NOTSUBSET:
|
||||
case TokenID.NOT_SUBSET:
|
||||
return colors.bgOrange;
|
||||
|
||||
case TokenID.NT_TUPLE:
|
||||
|
@ -347,10 +347,10 @@ export function colorBgSyntaxTree(node: ISyntaxTreeNode, colors: IColorTheme): s
|
|||
case TokenID.MULTIPLY:
|
||||
case TokenID.BOOLEAN:
|
||||
case TokenID.DECART:
|
||||
case TokenID.INTERSECTION:
|
||||
case TokenID.UNION:
|
||||
case TokenID.SET_INTERSECTION:
|
||||
case TokenID.SET_UNION:
|
||||
case TokenID.SET_MINUS:
|
||||
case TokenID.SYMMINUS:
|
||||
case TokenID.SET_SYMMETRIC_MINUS:
|
||||
case TokenID.REDUCE:
|
||||
case TokenID.CARD:
|
||||
case TokenID.BOOL:
|
||||
|
@ -372,8 +372,8 @@ export function colorBgSyntaxTree(node: ISyntaxTreeNode, colors: IColorTheme): s
|
|||
case TokenID.NT_RECURSIVE_SHORT:
|
||||
return '';
|
||||
|
||||
case TokenID.PUNC_ASSIGN:
|
||||
case TokenID.PUNC_ITERATE:
|
||||
case TokenID.PUNCTUATION_ASSIGN:
|
||||
case TokenID.PUNCTUATION_ITERATE:
|
||||
return colors.bgRed;
|
||||
}
|
||||
// node
|
||||
|
|
|
@ -5,9 +5,15 @@
|
|||
* Description is a long description used in tooltips.
|
||||
*/
|
||||
import { GramData,Grammeme, ReferenceType } from '@/models/language';
|
||||
import { CstMatchMode, DependencyMode, HelpTopic, LibraryFilterStrategy, UserAccessMode } from '@/models/miscellaneous';
|
||||
import {
|
||||
CstMatchMode, DependencyMode, HelpTopic,
|
||||
LibraryFilterStrategy, UserAccessMode
|
||||
} from '@/models/miscellaneous';
|
||||
import { CstClass, CstType, ExpressionStatus, IConstituenta } from '@/models/rsform';
|
||||
import { IArgumentInfo, IRSErrorDescription, ISyntaxTreeNode, ParsingStatus, RSErrorType, TokenID } from '@/models/rslang';
|
||||
import {
|
||||
IArgumentInfo, IRSErrorDescription, ISyntaxTreeNode,
|
||||
ParsingStatus, RSErrorType, TokenID
|
||||
} from '@/models/rslang';
|
||||
|
||||
/**
|
||||
* Generates description for {@link IConstituenta}.
|
||||
|
@ -56,88 +62,88 @@ export function labelConstituenta(cst: IConstituenta) {
|
|||
*/
|
||||
export function labelToken(id: TokenID): string {
|
||||
switch (id) {
|
||||
case TokenID.BOOLEAN: return 'ℬ()';
|
||||
case TokenID.DECART: return '×';
|
||||
case TokenID.PUNC_PL: return '( )';
|
||||
case TokenID.PUNC_SL: return '[ ]';
|
||||
case TokenID.FORALL: return '∀';
|
||||
case TokenID.EXISTS: return '∃';
|
||||
case TokenID.NOT: return '¬';
|
||||
case TokenID.AND: return '&';
|
||||
case TokenID.OR: return '∨';
|
||||
case TokenID.IMPLICATION: return '⇒';
|
||||
case TokenID.EQUIVALENT: return '⇔';
|
||||
case TokenID.LIT_EMPTYSET: return '∅';
|
||||
case TokenID.LIT_INTSET: return 'Z';
|
||||
case TokenID.EQUAL: return '=';
|
||||
case TokenID.NOTEQUAL: return '≠';
|
||||
case TokenID.GREATER_OR_EQ: return '≥';
|
||||
case TokenID.LESSER_OR_EQ: return '≤';
|
||||
case TokenID.IN: return '∈';
|
||||
case TokenID.NOTIN: return '∉';
|
||||
case TokenID.SUBSET_OR_EQ: return '⊆';
|
||||
case TokenID.SUBSET: return '⊂';
|
||||
case TokenID.NOTSUBSET: return '⊄';
|
||||
case TokenID.INTERSECTION: return '∩';
|
||||
case TokenID.UNION: return '∪';
|
||||
case TokenID.SET_MINUS: return '\\';
|
||||
case TokenID.SYMMINUS: return '∆';
|
||||
case TokenID.BOOLEAN: return 'ℬ()';
|
||||
case TokenID.DECART: return '×';
|
||||
case TokenID.PUNCTUATION_PL: return '( )';
|
||||
case TokenID.PUNCTUATION_SL: return '[ ]';
|
||||
case TokenID.QUANTOR_UNIVERSAL: return '∀';
|
||||
case TokenID.QUANTOR_EXISTS: return '∃';
|
||||
case TokenID.LOGIC_NOT: return '¬';
|
||||
case TokenID.LOGIC_AND: return '&';
|
||||
case TokenID.LOGIC_OR: return '∨';
|
||||
case TokenID.LOGIC_IMPLICATION: return '⇒';
|
||||
case TokenID.LOGIC_EQUIVALENT: return '⇔';
|
||||
case TokenID.LIT_EMPTYSET: return '∅';
|
||||
case TokenID.LIT_WHOLE_NUMBERS: return 'Z';
|
||||
case TokenID.EQUAL: return '=';
|
||||
case TokenID.NOTEQUAL: return '≠';
|
||||
case TokenID.GREATER_OR_EQ: return '≥';
|
||||
case TokenID.LESSER_OR_EQ: return '≤';
|
||||
case TokenID.SET_IN: return '∈';
|
||||
case TokenID.SET_NOT_IN: return '∉';
|
||||
case TokenID.SUBSET_OR_EQ: return '⊆';
|
||||
case TokenID.SUBSET: return '⊂';
|
||||
case TokenID.NOT_SUBSET: return '⊄';
|
||||
case TokenID.SET_INTERSECTION: return '∩';
|
||||
case TokenID.SET_UNION: return '∪';
|
||||
case TokenID.SET_MINUS: return '\\';
|
||||
case TokenID.SET_SYMMETRIC_MINUS: return '∆';
|
||||
case TokenID.NT_DECLARATIVE_EXPR: return 'D{}';
|
||||
case TokenID.NT_IMPERATIVE_EXPR: return 'I{}';
|
||||
case TokenID.NT_RECURSIVE_FULL: return 'R{}';
|
||||
case TokenID.BIGPR: return 'Pr1()';
|
||||
case TokenID.SMALLPR: return 'pr1()';
|
||||
case TokenID.FILTER: return 'Fi1[]()';
|
||||
case TokenID.REDUCE: return 'red()';
|
||||
case TokenID.CARD: return 'card()';
|
||||
case TokenID.BOOL: return 'bool()';
|
||||
case TokenID.DEBOOL: return 'debool()';
|
||||
case TokenID.PUNC_ASSIGN: return ':=';
|
||||
case TokenID.PUNC_ITERATE: return ':∈';
|
||||
case TokenID.BIGPR: return 'Pr1()';
|
||||
case TokenID.SMALLPR: return 'pr1()';
|
||||
case TokenID.FILTER: return 'Fi1[]()';
|
||||
case TokenID.REDUCE: return 'red()';
|
||||
case TokenID.CARD: return 'card()';
|
||||
case TokenID.BOOL: return 'bool()';
|
||||
case TokenID.DEBOOL: return 'debool()';
|
||||
case TokenID.PUNCTUATION_ASSIGN: return ':=';
|
||||
case TokenID.PUNCTUATION_ITERATE: return ':∈';
|
||||
}
|
||||
return `no label: ${id}`;
|
||||
}
|
||||
|
||||
export function describeToken(id: TokenID): string {
|
||||
switch (id) {
|
||||
case TokenID.BOOLEAN: return 'Булеан [Alt + E / Shift + B]';
|
||||
case TokenID.DECART: return 'Декартово произведение [Alt + Shift + E / Shift + 8]';
|
||||
case TokenID.PUNC_PL: return 'Скобки вокруг выражения [Alt + Shift + 9 ]';
|
||||
case TokenID.PUNC_SL: return 'Скобки вокруг выражения [Alt + [ ]';
|
||||
case TokenID.FORALL: return 'Квантор всеобщности [`]';
|
||||
case TokenID.EXISTS: return 'Квантор существования [Shift + `]';
|
||||
case TokenID.NOT: return 'Отрицание [Alt + `]';
|
||||
case TokenID.AND: return 'Конъюнкция [Alt + 3 ~ Shift + 7]';
|
||||
case TokenID.OR: return 'Дизъюнкция [Alt + Shift + 3]';
|
||||
case TokenID.IMPLICATION: return 'Импликация [Alt + 4]';
|
||||
case TokenID.EQUIVALENT: return 'Эквивалентность [Alt + Shift + 4]';
|
||||
case TokenID.LIT_EMPTYSET: return 'Пустое множество [Alt + X]';
|
||||
case TokenID.LIT_INTSET: return 'Целые числа [Alt + Z]';
|
||||
case TokenID.EQUAL: return 'Равенство';
|
||||
case TokenID.NOTEQUAL: return 'Неравенство [Alt + Shift + `]';
|
||||
case TokenID.GREATER_OR_EQ: return 'Больше или равно [Alt + Shift + 7]';
|
||||
case TokenID.LESSER_OR_EQ: return 'Меньше или равно [Alt + Shift + 8]';
|
||||
case TokenID.IN: return 'Быть элементом (принадлежит) [Alt + 1]';
|
||||
case TokenID.NOTIN: return 'Не принадлежит [Alt + Shift + 1]';
|
||||
case TokenID.SUBSET_OR_EQ: return 'Быть частью (нестрогое подмножество) [Alt + 2]';
|
||||
case TokenID.SUBSET: return 'Строгое подмножество [Alt + 7]';
|
||||
case TokenID.NOTSUBSET: return 'Не подмножество [Alt + Shift + 2]';
|
||||
case TokenID.INTERSECTION: return 'Пересечение [Alt + A]';
|
||||
case TokenID.UNION: return 'Объединение [Alt + S]';
|
||||
case TokenID.SET_MINUS: return 'Разность множеств [Alt + 5]';
|
||||
case TokenID.SYMMINUS: return 'Симметрическая разность [Alt + Shift + 5]';
|
||||
case TokenID.NT_DECLARATIVE_EXPR: return 'Декларативная форма определения терма [Alt + D]';
|
||||
case TokenID.NT_IMPERATIVE_EXPR: return 'Императивная форма определения терма [Alt + G]';
|
||||
case TokenID.NT_RECURSIVE_FULL: return 'Рекурсивная (цикличная) форма определения терма [Alt + T]';
|
||||
case TokenID.BIGPR: return 'Большая проекция [Alt + Q]';
|
||||
case TokenID.SMALLPR: return 'Малая проекция [Alt + W]';
|
||||
case TokenID.FILTER: return 'Фильтр [Alt + F]';
|
||||
case TokenID.REDUCE: return 'Множество-сумма [Alt + R]';
|
||||
case TokenID.CARD: return 'Мощность [Alt + C]';
|
||||
case TokenID.BOOL: return 'Синглетон [Alt + B]';
|
||||
case TokenID.DEBOOL: return 'Десинглетон [Alt + V]';
|
||||
case TokenID.PUNC_ASSIGN: return 'Присвоение (императивный синтаксис) [Alt + Shift + 6]';
|
||||
case TokenID.PUNC_ITERATE: return 'Перебор элементов множества (императивный синтаксис) [Alt + 6]';
|
||||
case TokenID.BOOLEAN: return 'Булеан [Alt + E / Shift + B]';
|
||||
case TokenID.DECART: return 'Декартово произведение [Alt + Shift + E / Shift + 8]';
|
||||
case TokenID.PUNCTUATION_PL: return 'Скобки вокруг выражения [Alt + Shift + 9 ]';
|
||||
case TokenID.PUNCTUATION_SL: return 'Скобки вокруг выражения [Alt + [ ]';
|
||||
case TokenID.QUANTOR_UNIVERSAL: return 'Квантор всеобщности [`]';
|
||||
case TokenID.QUANTOR_EXISTS: return 'Квантор существования [Shift + `]';
|
||||
case TokenID.LOGIC_NOT: return 'Отрицание [Alt + `]';
|
||||
case TokenID.LOGIC_AND: return 'Конъюнкция [Alt + 3 ~ Shift + 7]';
|
||||
case TokenID.LOGIC_OR: return 'Дизъюнкция [Alt + Shift + 3]';
|
||||
case TokenID.LOGIC_IMPLICATION: return 'Импликация [Alt + 4]';
|
||||
case TokenID.LOGIC_EQUIVALENT: return 'Эквивалентность [Alt + Shift + 4]';
|
||||
case TokenID.LIT_EMPTYSET: return 'Пустое множество [Alt + X]';
|
||||
case TokenID.LIT_WHOLE_NUMBERS: return 'Целые числа [Alt + Z]';
|
||||
case TokenID.EQUAL: return 'Равенство';
|
||||
case TokenID.NOTEQUAL: return 'Неравенство [Alt + Shift + `]';
|
||||
case TokenID.GREATER_OR_EQ: return 'Больше или равно [Alt + Shift + 7]';
|
||||
case TokenID.LESSER_OR_EQ: return 'Меньше или равно [Alt + Shift + 8]';
|
||||
case TokenID.SET_IN: return 'Быть элементом (принадлежит) [Alt + 1]';
|
||||
case TokenID.SET_NOT_IN: return 'Не принадлежит [Alt + Shift + 1]';
|
||||
case TokenID.SUBSET_OR_EQ: return 'Быть частью (нестрогое подмножество) [Alt + 2]';
|
||||
case TokenID.SUBSET: return 'Строгое подмножество [Alt + 7]';
|
||||
case TokenID.NOT_SUBSET: return 'Не подмножество [Alt + Shift + 2]';
|
||||
case TokenID.SET_INTERSECTION: return 'Пересечение [Alt + A]';
|
||||
case TokenID.SET_UNION: return 'Объединение [Alt + S]';
|
||||
case TokenID.SET_MINUS: return 'Разность множеств [Alt + 5]';
|
||||
case TokenID.SET_SYMMETRIC_MINUS: return 'Симметрическая разность [Alt + Shift + 5]';
|
||||
case TokenID.NT_DECLARATIVE_EXPR: return 'Декларативная форма определения терма [Alt + D]';
|
||||
case TokenID.NT_IMPERATIVE_EXPR: return 'Императивная форма определения терма [Alt + G]';
|
||||
case TokenID.NT_RECURSIVE_FULL: return 'Рекурсивная (цикличная) форма определения терма [Alt + T]';
|
||||
case TokenID.BIGPR: return 'Большая проекция [Alt + Q]';
|
||||
case TokenID.SMALLPR: return 'Малая проекция [Alt + W]';
|
||||
case TokenID.FILTER: return 'Фильтр [Alt + F]';
|
||||
case TokenID.REDUCE: return 'Множество-сумма [Alt + R]';
|
||||
case TokenID.CARD: return 'Мощность [Alt + C]';
|
||||
case TokenID.BOOL: return 'Синглетон [Alt + B]';
|
||||
case TokenID.DEBOOL: return 'Десинглетон [Alt + V]';
|
||||
case TokenID.PUNCTUATION_ASSIGN: return 'Присвоение (императивный синтаксис) [Alt + Shift + 6]';
|
||||
case TokenID.PUNCTUATION_ITERATE: return 'Перебор элементов множества (императивный синтаксис) [Alt + 6]';
|
||||
}
|
||||
return `no description: ${id}`;
|
||||
}
|
||||
|
@ -232,14 +238,14 @@ new Map([
|
|||
['forceatlas2', 'Граф: Атлас 2D'],
|
||||
['forceDirected2d', 'Граф: Силы 2D'],
|
||||
['forceDirected3d', 'Граф: Силы 3D'],
|
||||
['treeTd2d', 'Граф: ДеревоВерт 2D'],
|
||||
['treeTd3d', 'Граф: ДеревоВерт 3D'],
|
||||
['treeTd2d', 'Граф: ДеревоВер 2D'],
|
||||
['treeTd3d', 'Граф: ДеревоВер 3D'],
|
||||
['treeLr2d', 'Граф: ДеревоГор 2D'],
|
||||
['treeLr3d', 'Граф: ДеревоГор 3D'],
|
||||
['radialOut2d', 'Граф: Радиальная 2D'],
|
||||
['radialOut3d', 'Граф: Радиальная 3D'],
|
||||
['circular2d', 'Граф: Круговая'],
|
||||
['hierarchicalTd', 'Граф: ИерархияВерт'],
|
||||
['hierarchicalTd', 'Граф: ИерархияВер'],
|
||||
['hierarchicalLr', 'Граф: ИерархияГор'],
|
||||
['nooverlap', 'Граф: Без перекрытия']
|
||||
]);
|
||||
|
@ -430,44 +436,44 @@ export function labelSyntaxTree(node: ISyntaxTreeNode): string {
|
|||
|
||||
case TokenID.NT_ENUM_DECL: return 'ENUM_DECLARATION';
|
||||
case TokenID.NT_TUPLE_DECL: return 'TUPLE_DECLARATION';
|
||||
case TokenID.PUNC_DEFINE: return 'DEFINITION';
|
||||
case TokenID.PUNC_STRUCT: return 'STRUCTURE_DEFITION';
|
||||
case TokenID.PUNCTUATION_DEFINE: return 'DEFINITION';
|
||||
case TokenID.PUNCTUATION_STRUCT: return 'STRUCTURE_DEFINITION';
|
||||
|
||||
case TokenID.NT_ARG_DECL: return 'ARG';
|
||||
case TokenID.NT_FUNC_CALL: return 'CALL';
|
||||
case TokenID.NT_ARGUMENTS: return 'ARGS';
|
||||
|
||||
case TokenID.NT_FUNC_DEFINITION: return 'FUNCTION_DEFINITION';
|
||||
case TokenID.NT_IMP_DECLARE: return 'IDECLARE';
|
||||
case TokenID.NT_IMP_ASSIGN: return 'IASSIGN';
|
||||
case TokenID.NT_IMP_LOGIC: return 'ICHECK';
|
||||
case TokenID.NT_IMP_DECLARE: return 'DECLARE';
|
||||
case TokenID.NT_IMP_ASSIGN: return 'ASSIGN';
|
||||
case TokenID.NT_IMP_LOGIC: return 'CHECK';
|
||||
|
||||
case TokenID.NT_RECURSIVE_SHORT: return labelToken(TokenID.NT_RECURSIVE_FULL);
|
||||
|
||||
case TokenID.BOOLEAN:
|
||||
case TokenID.DECART:
|
||||
case TokenID.FORALL:
|
||||
case TokenID.EXISTS:
|
||||
case TokenID.NOT:
|
||||
case TokenID.AND:
|
||||
case TokenID.OR:
|
||||
case TokenID.IMPLICATION:
|
||||
case TokenID.EQUIVALENT:
|
||||
case TokenID.QUANTOR_UNIVERSAL:
|
||||
case TokenID.QUANTOR_EXISTS:
|
||||
case TokenID.LOGIC_NOT:
|
||||
case TokenID.LOGIC_AND:
|
||||
case TokenID.LOGIC_OR:
|
||||
case TokenID.LOGIC_IMPLICATION:
|
||||
case TokenID.LOGIC_EQUIVALENT:
|
||||
case TokenID.LIT_EMPTYSET:
|
||||
case TokenID.LIT_INTSET:
|
||||
case TokenID.LIT_WHOLE_NUMBERS:
|
||||
case TokenID.EQUAL:
|
||||
case TokenID.NOTEQUAL:
|
||||
case TokenID.GREATER_OR_EQ:
|
||||
case TokenID.LESSER_OR_EQ:
|
||||
case TokenID.IN:
|
||||
case TokenID.NOTIN:
|
||||
case TokenID.SET_IN:
|
||||
case TokenID.SET_NOT_IN:
|
||||
case TokenID.SUBSET_OR_EQ:
|
||||
case TokenID.SUBSET:
|
||||
case TokenID.NOTSUBSET:
|
||||
case TokenID.INTERSECTION:
|
||||
case TokenID.UNION:
|
||||
case TokenID.NOT_SUBSET:
|
||||
case TokenID.SET_INTERSECTION:
|
||||
case TokenID.SET_UNION:
|
||||
case TokenID.SET_MINUS:
|
||||
case TokenID.SYMMINUS:
|
||||
case TokenID.SET_SYMMETRIC_MINUS:
|
||||
case TokenID.NT_DECLARATIVE_EXPR:
|
||||
case TokenID.NT_IMPERATIVE_EXPR:
|
||||
case TokenID.NT_RECURSIVE_FULL:
|
||||
|
@ -475,8 +481,8 @@ export function labelSyntaxTree(node: ISyntaxTreeNode): string {
|
|||
case TokenID.CARD:
|
||||
case TokenID.BOOL:
|
||||
case TokenID.DEBOOL:
|
||||
case TokenID.PUNC_ASSIGN:
|
||||
case TokenID.PUNC_ITERATE:
|
||||
case TokenID.PUNCTUATION_ASSIGN:
|
||||
case TokenID.PUNCTUATION_ITERATE:
|
||||
return labelToken(node.typeID);
|
||||
}
|
||||
// node
|
||||
|
@ -526,9 +532,9 @@ export function labelGrammeme(gram: GramData): string {
|
|||
case Grammeme.tran: return 'Переходный: да';
|
||||
case Grammeme.intr: return 'Переходный: нет';
|
||||
|
||||
case Grammeme.pres: return 'Время: наст';
|
||||
case Grammeme.past: return 'Время: прош';
|
||||
case Grammeme.futr: return 'Время: буд';
|
||||
case Grammeme.pres: return 'Время: настоящее';
|
||||
case Grammeme.past: return 'Время: прошедшее';
|
||||
case Grammeme.futr: return 'Время: будущее';
|
||||
|
||||
case Grammeme.per1: return 'Лицо: 1';
|
||||
case Grammeme.per2: return 'Лицо: 2';
|
||||
|
|
|
@ -77,7 +77,7 @@ export const SelectorGrammemesList = [
|
|||
/**
|
||||
* Represents options for {@link Grammeme} selector.
|
||||
*/
|
||||
export const SelectorGrammems: IGrammemeOption[] =
|
||||
export const SelectorGrammemes: IGrammemeOption[] =
|
||||
SelectorGrammemesList.map(
|
||||
gram => ({
|
||||
value: gram,
|
||||
|
@ -98,7 +98,7 @@ export const SelectorReferenceType = (
|
|||
/**
|
||||
* Represents recommended wordforms data.
|
||||
*/
|
||||
export const PremadeWordForms = [
|
||||
export const DefaultWordForms = [
|
||||
{ text: 'ед им', example: 'ручка', grams: [Grammeme.sing, Grammeme.nomn] },
|
||||
{ text: 'ед род', example: 'ручки', grams: [Grammeme.sing, Grammeme.gent] },
|
||||
{ text: 'ед дат', example: 'ручке', grams: [Grammeme.sing, Grammeme.datv] },
|
||||
|
|
Loading…
Reference in New Issue
Block a user