[Initial] Build: PL By: JS

本文档是一份关于如何实现编程语言的教程,适用于JavaScript/NodeJS程序员。内容涵盖解析器、解释器、编译器的编写,以及代码转换技巧等主题。

Origin: http://lisperator.net/pltut/

This is a tutorial on how to implement a programming language.

If you ever wrote an interpreter or a compiler, then there is probably nothing new for you here.

But, if you’re using regexps to “parse” anything that looks like a programming language, then please read at least the section on parsing. Let’s write less buggy code!

The ToC on the right is in “simple-to-advanced” order. I’d recommend you not to skip forward, unless you know the subject well. You can always refer back if you don’t understand something. Also, questions and feedback are very much appreciated!

The target audience is the average JavaScript / NodeJS programmer.

What are we going to learn

  • What is a parser, and how to write one.
  • How to write an interpreter.
  • Continuations, and why are they important.
  • Writing a compiler.
  • How to transform code to continuation-passing style.
  • A few basic optimization techniques.
  • Examples of what our λanguage brings new over plain JavaScript.

Description of the language

# this is a comment

println("Hello World!");

println(2 + 3 * 4);

# functions are introduced with `lambda` or `
fib = lambda (n) if n < 2 then n else fib(n - 1) + fib(n - 2);

println(fib(15));

print-range = λ(a, b)             # ` is synonym to `lambda`
                if a <= b then {  # `then` here is optional as you can see below
                  print(a);
                  if a + 1 <= b {
                    print(", ");
                    print-range(a + 1, b);
                  } else println("");        # newline
                };
print-range(1, 5);

Output

Hello World!
14
610
1, 2, 3, 4, 5

The λanguage looks a bit like JavaScript, but it’s different.

First, there are no statements, only expressions.

An expression returns a value and can be used in place of any other expression.

Semicolons are required to separate expressions in a “sequence”.

The curly brackets, { and }, create such a sequence, and it’s itself an expression.

Its value is what the last expression evaluates to.

The following is a valid program:

a = {
  fib(10);  # has no side-effects, but it's computed anyway
  fib(15)   # the last semicolon can be missing
};
print(a); # prints 610

Functions are introduced with one of the keywords lambda or λ (they are synonyms). After the keyword there must be a (possibly empty) parenthesized list of variable names separated with commas, like in JavaScript — these are the argument names. The function body is a single expression, but it can be a sequence wrapped in {…}. There is no return statement (there are no statements) — the last expression evaluated in a function gives the value to return to its caller.

There is no var. To introduce new variables, you can use what JavaScripters call “IIFE”. Use a lambda, declare variables as arguments. Variables have function scope, and functions are closures — like in JavaScript.

Even if is itself an expression. In JavaScript you’d get that effect with the ternary operator:

a = foo() ? bar() : baz();           // JavaScript
a = if foo() then bar() else baz();  # λanguage

The then keyword is optional when the branch starts with an open bracket ({), as you can see in print-range above. Otherwise it is required. The else keyword is required if the alternative branch is present. Again, then and else take as body a single expression, but you can {group} multiple expressions by using brackets and semicolons. When the else branch is missing and the condition is false, the result of the if expression is false. Speaking of which, false is a keyword which denotes the only falsy value in our λanguage:

if foo() then print("OK");

will print “OK” if and only if the result of foo() is NOT false. There’s also a true keyword for completion, but really everything which is not false (in terms of JavaScript’s === operator) will be interpreted as true in conditionals (including the number 0 and the empty string “”).

Also note above that there is no point to demand parentheses around an if’s condition. It’s no error if you add them, though, as an open paren starts an expression — but they’re just superfluous.

A whole program is parsed as if it were embedded in curly brackets, therefore you need to place a semicolon after each expression. The last expression can be an exception.


Well, that’s our tiny λanguage. It’s not necessarily a good one. The syntax looks cute, but it has its traps. There are a lot of missing features, like objects or arrays; we don’t concentrate on them because they’re not essential for our journey. If you understand all this material, you’ll be able to implement those easily.

In the next section we’ll write a parser for this λanguage.

[root@yfw ~]# cd /www/wwwroot/szrengjing.com/jsxc/jsxc-master [root@yfw jsxc-master]# cd /www/wwwroot/szrengjing.com/jsxc/jsxc-master [root@yfw jsxc-master]# [root@yfw jsxc-master]# # 初始化 git 仓库 [root@yfw jsxc-master]# sudo -u www git init Initialized empty Git repository in /www/wwwroot/szrengjing.com/jsxc/jsxc-master/.git/ [root@yfw jsxc-master]# sudo -u www git add . [root@yfw jsxc-master]# sudo -u www git commit -m "Initial commit for build" *** Please tell me who you are. Run git config --global user.email "you@example.com" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository. fatal: empty ident name (for <www@yfw.szrengjing.com>) not allowed [root@yfw jsxc-master]# npm list git-revision-webpack-plugin @jsxc/jsxc@4.4.0 /www/wwwroot/szrengjing.com/jsxc/jsxc-master └── git-revision-webpack-plugin@3.0.6 [root@yfw jsxc-master]# sudo -u www yarn build yarn run v1.22.22 warning ../../package.json: No license field $ webpack --progress --config webpack.config.js --mode production fatal: Not a valid object name HEAD [webpack-cli] Failed to load '/www/wwwroot/szrengjing.com/jsxc/jsxc-master/webpack.config.js' config [webpack-cli] Error: Command failed: git describe --always fatal: Not a valid object name HEAD at checkExecSyncError (child_process.js:635:11) at execSync (child_process.js:671:15) at module.exports (/www/wwwroot/szrengjing.com/jsxc/jsxc-master/node_modules/git-revision-webpack-plugin/lib/helpers/run-git-command.js:25:34) at GitRevisionPlugin.version (/www/wwwroot/szrengjing.com/jsxc/jsxc-master/node_modules/git-revision-webpack-plugin/lib/index.js:65:10) at Object.<anonymous> (/www/wwwroot/szrengjing.com/jsxc/jsxc-master/webpack.config.js:52:85) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Module.require (internal/modules/cjs/loader.js:887:19) { status: 128, signal: null, output: [ null, <Buffer >, <Buffer 66 61 74 61 6c 3a 20 4e 6f 74 20 61 20 76 61 6c 69 64 20 6f 62 6a 65 63 74 20 6e 61 6d 65 20 48 45 41 44 0a> ], pid: 647253, stdout: <Buffer >, stderr: <Buffer 66 61 74 61 6c 3a 20 4e 6f 74 20 61 20 76 61 6c 69 64 20 6f 62 6a 65 63 74 20 6e 61 6d 65 20 48 45 41 44 0a> } error Command failed with exit code 2. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. [root@yfw jsxc-master]# sudo -u www yarn build --bundleAnalyzer yarn run v1.22.22 warning ../../package.json: No license field $ webpack --progress --config webpack.config.js --mode production --bundleAnalyzer [webpack-cli] Error: Unknown option '--bundleAnalyzer' [webpack-cli] Run 'webpack --help' to see available commands and options error Command failed with exit code 2. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. [root@yfw jsxc-master]# # 为 www 用户设置 Git 身份(局部设置,仅对当前目) [root@yfw jsxc-master]# sudo -u www git config user.name "JSXC Builder" [root@yfw jsxc-master]# sudo -u www git config user.email "builder@localhost" [root@yfw jsxc-master]# sudo -u www git commit -m "Initial commit for build" [master (root-commit) ad2386e] Initial commit for build 510 files changed, 61602 insertions(+) create mode 100755 .commitlintrc.json create mode 100755 .editorconfig create mode 100755 .eslintrc.js create mode 100755 .fantasticonrc.js create mode 100755 .github/FUNDING.yml create mode 100755 .github/ISSUE_TEMPLATE/bug_report.md create mode 100755 .github/ISSUE_TEMPLATE/feature-request.md create mode 100755 .github/workflows/commitlint.yml create mode 100755 .github/workflows/wti.yml create mode 100755 .github/workflows/yarn.yml create mode 100755 .gitignore create mode 100755 .lgtm.yml create mode 100755 .npmignore create mode 100755 .prettierrc.json create mode 100755 .stylelintrc create mode 100755 .vscode/settings.json create mode 100755 CHANGELOG.md create mode 100755 CODE_OF_CONDUCT.md create mode 100755 CONTRIBUTING.md create mode 100755 LICENSE create mode 100755 README.md create mode 100755 custom.d.ts create mode 100755 example/ajax/getturncredentials.json create mode 100755 example/css/bootstrap.min.css create mode 100755 example/css/example.css create mode 100755 example/css/images/ui-icons_444444_256x240.png create mode 100755 example/css/images/ui-icons_555555_256x240.png create mode 100755 example/css/images/ui-icons_777620_256x240.png create mode 100755 example/css/images/ui-icons_777777_256x240.png create mode 100755 example/css/images/ui-icons_cc0000_256x240.png create mode 100755 example/css/images/ui-icons_ffffff_256x240.png create mode 100755 example/favicon.ico create mode 100755 example/fonts/glyphicons-halflings-regular.eot create mode 100755 example/fonts/glyphicons-halflings-regular.svg create mode 100755 example/fonts/glyphicons-halflings-regular.ttf create mode 100755 example/fonts/glyphicons-halflings-regular.woff create mode 100755 example/fonts/glyphicons-halflings-regular.woff2 create mode 100755 example/index.html create mode 100755 example/js/example.js create mode 100755 example/js/helper.js create mode 100755 example/js/jquery.min.js create mode 100755 example/login.html create mode 100755 fonts/jsxc-icons.eot create mode 100755 fonts/jsxc-icons.scss create mode 100755 fonts/jsxc-icons.woff create mode 100755 fonts/jsxc-icons.woff2 create mode 100755 images/XMPP_logo.png create mode 100755 images/camera_disabled_icon_white.svg create mode 100755 images/download_icon_black.svg create mode 100755 images/dragover_white.svg create mode 100755 images/drop_white.svg create mode 100755 images/emoticons/jabber.svg create mode 100755 images/emoticons/jsxc.svg create mode 100755 images/emoticons/klaus.svg create mode 100755 images/emoticons/nextcloud.svg create mode 100755 images/emoticons/owncloud.svg create mode 100755 images/emoticons/xmpp.svg create mode 100755 images/filetypes/application-pdf.png create mode 100755 images/filetypes/application-pdf.svg create mode 100755 images/filetypes/application.png create mode 100755 images/filetypes/application.svg create mode 100755 images/filetypes/audio.png create mode 100755 images/filetypes/audio.svg create mode 100755 images/filetypes/file.png create mode 100755 images/filetypes/file.svg create mode 100755 images/filetypes/folder-drag-accept.png create mode 100755 images/filetypes/folder-drag-accept.svg create mode 100755 images/filetypes/folder-external.png create mode 100755 images/filetypes/folder-external.svg create mode 100755 images/filetypes/folder-public.png create mode 100755 images/filetypes/folder-public.svg create mode 100755 images/filetypes/folder-shared.png create mode 100755 images/filetypes/folder-shared.svg create mode 100755 images/filetypes/folder-starred.png create mode 100755 images/filetypes/folder-starred.svg create mode 100755 images/filetypes/folder.png create mode 100755 images/filetypes/folder.svg create mode 100755 images/filetypes/image.png create mode 100755 images/filetypes/image.svg create mode 100755 images/filetypes/package-x-generic.png create mode 100755 images/filetypes/package-x-generic.svg create mode 100755 images/filetypes/text-calendar.png create mode 100755 images/filetypes/text-calendar.svg create mode 100755 images/filetypes/text-code.png create mode 100755 images/filetypes/text-code.svg create mode 100755 images/filetypes/text-vcard.png create mode 100755 images/filetypes/text-vcard.svg create mode 100755 images/filetypes/text.png create mode 100755 images/filetypes/text.svg create mode 100755 images/filetypes/video.png create mode 100755 images/filetypes/video.svg create mode 100755 images/filetypes/x-office-document.png create mode 100755 images/filetypes/x-office-document.svg create mode 100755 images/filetypes/x-office-presentation.png create mode 100755 images/filetypes/x-office-presentation.svg create mode 100755 images/filetypes/x-office-spreadsheet.png create mode 100755 images/filetypes/x-office-spreadsheet.svg create mode 100755 images/group_white.svg create mode 100755 images/icons/attachment.svg create mode 100755 images/icons/bell.svg create mode 100755 images/icons/bookmark.svg create mode 100755 images/icons/camera-disabled.svg create mode 100755 images/icons/camera.svg create mode 100755 images/icons/channel.svg create mode 100755 images/icons/close.svg create mode 100755 images/icons/contact.svg create mode 100755 images/icons/delete.svg create mode 100755 images/icons/download.svg create mode 100755 images/icons/dragover.svg create mode 100755 images/icons/drop.svg create mode 100755 images/icons/edit.svg create mode 100755 images/icons/fullscreen.svg create mode 100755 images/icons/gear.svg create mode 100755 images/icons/group.svg create mode 100755 images/icons/groupcontact.svg create mode 100755 images/icons/hang-up.svg create mode 100755 images/icons/help.svg create mode 100755 images/icons/info.svg create mode 100755 images/icons/jsxc.svg create mode 100755 images/icons/location.svg create mode 100755 images/icons/maximize.svg create mode 100755 images/icons/megaphone.svg create mode 100755 images/icons/menu.svg create mode 100755 images/icons/microphone-disabled.svg create mode 100755 images/icons/microphone.svg create mode 100755 images/icons/minimize.svg create mode 100755 images/icons/more.svg create mode 100755 images/icons/mute.svg create mode 100755 images/icons/nonanonymous-group.svg create mode 100755 images/icons/padlock-close.svg create mode 100755 images/icons/padlock-open-disabled.svg create mode 100755 images/icons/padlock-open.svg create mode 100755 images/icons/pick-up-disabled.svg create mode 100755 images/icons/pick-up.svg create mode 100755 images/icons/placeholder.svg create mode 100755 images/icons/quotation.svg create mode 100755 images/icons/resize.svg create mode 100755 images/icons/search.svg create mode 100755 images/icons/smiley.svg create mode 100755 images/icons/speech-balloon.svg create mode 100755 images/jsxc_white.svg create mode 100755 images/loading.gif create mode 100755 images/location_icon.svg create mode 100755 images/placeholder_image.svg create mode 100755 images/presence/away.svg create mode 100755 images/presence/chat.svg create mode 100755 images/presence/dnd.svg create mode 100755 images/presence/online.svg create mode 100755 images/presence/xa.svg create mode 100755 images/resize_gray.svg create mode 100755 karma.conf.js create mode 100755 locales/ar.json create mode 100755 locales/bg.json create mode 100755 locales/bn-BD.json create mode 100755 locales/cs.json create mode 100755 locales/de.json create mode 100755 locales/el.json create mode 100755 locales/en.json create mode 100755 locales/es.json create mode 100755 locales/fa-AF.json create mode 100755 locales/fi.json create mode 100755 locales/fr.json create mode 100755 locales/hu-HU.json create mode 100755 locales/it.json create mode 100755 locales/ja.json create mode 100755 locales/ko.json create mode 100755 locales/nds.json create mode 100755 locales/nl-NL.json create mode 100755 locales/pl.json create mode 100755 locales/pt-BR.json create mode 100755 locales/ro.json create mode 100755 locales/ru.json create mode 100755 locales/sk.json create mode 100755 locales/sq.json create mode 100755 locales/sv-SE.json create mode 100755 locales/th.json create mode 100755 locales/tr-TR.json create mode 100755 locales/uk-UA.json create mode 100755 locales/vi-VN.json create mode 100755 locales/zh-TW.json create mode 100755 locales/zh.json create mode 100755 package.json create mode 100755 scripts/build-release.js create mode 100755 scripts/prepare-commit-msg.js create mode 100755 scripts/publish-release.js create mode 100755 scss/main.scss create mode 100755 scss/modules/_all.scss create mode 100755 scss/modules/_animation.scss create mode 100755 scss/modules/_colors.scss create mode 100755 scss/modules/_muc.scss create mode 100755 scss/modules/_presence.scss create mode 100755 scss/modules/_scrollbar.scss create mode 100755 scss/modules/_webrtc.scss create mode 100755 scss/partials/_avatar.scss create mode 100755 scss/partials/_bar.scss create mode 100755 scss/partials/_button.scss create mode 100755 scss/partials/_dialog.scss create mode 100755 scss/partials/_emoticons.scss create mode 100755 scss/partials/_icon.scss create mode 100755 scss/partials/_jsxc.scss create mode 100755 scss/partials/_layout.scss create mode 100755 scss/partials/_menu.scss create mode 100755 scss/partials/_muc.scss create mode 100755 scss/partials/_roster.scss create mode 100755 scss/partials/_webrtc.scss create mode 100755 scss/partials/_window-list.scss create mode 100755 scss/partials/_window.scss create mode 100755 scss/vendor/_all.scss create mode 100755 sound/credential create mode 100755 sound/incoming-call.mp3 create mode 100755 sound/notification.mp3 create mode 100755 sound/ping.mp3 create mode 100755 src/Account.ts create mode 100755 src/AccountManager.ts create mode 100755 src/Attachment.ts create mode 100755 src/Avatar.interface.ts create mode 100755 src/Avatar.ts create mode 100755 src/CONST.ts create mode 100755 src/Call.ts create mode 100755 src/CallManager.ts create mode 100755 src/ChatWindowController.ts create mode 100755 src/Client.interface.ts create mode 100755 src/Client.ts create mode 100755 src/ClientAvatar.ts create mode 100755 src/CommandRepository.ts create mode 100755 src/Contact.interface.ts create mode 100755 src/Contact.ts create mode 100755 src/ContactManager.ts create mode 100755 src/ContactProvider.ts create mode 100755 src/DiscoInfo.interface.ts create mode 100755 src/DiscoInfo.ts create mode 100755 src/DiscoInfoChangeable.ts create mode 100755 src/DiscoInfoRepository.interface.ts create mode 100755 src/DiscoInfoRepository.ts create mode 100755 src/DiscoInfoVersion.ts create mode 100755 src/Emoticons.ts create mode 100755 src/FallbackContactProvider.ts create mode 100755 src/FormWatcher.ts create mode 100755 src/IceServers.ts create mode 100755 src/Identifiable.interface.ts create mode 100755 src/JID.interface.ts create mode 100755 src/JID.ts create mode 100755 src/JingleAbstractSession.ts create mode 100755 src/JingleCallFactory.ts create mode 100755 src/JingleCallSession.ts create mode 100755 src/JingleMediaSession.ts create mode 100755 src/JingleSessionFactory.ts create mode 100755 src/JingleStreamSession.ts create mode 100755 src/LinkHandler.interface.ts create mode 100755 src/LinkHandlerGeo.ts create mode 100755 src/LinkHandlerXMPP.ts create mode 100755 src/Menu.ts create mode 100755 src/MenuChatMessage.ts create mode 100755 src/MenuItemFactory.interface.ts create mode 100755 src/MenuItemStaticFactory.ts create mode 100755 src/Message.interface.ts create mode 100755 src/Message.ts create mode 100755 src/Migration.ts create mode 100755 src/MultiUserContact.ts create mode 100755 src/Notice.ts create mode 100755 src/NoticeManager.ts create mode 100755 src/Notification.ts create mode 100755 src/Options.ts create mode 100755 src/OptionsDefault.ts create mode 100755 src/PageVisibility.ts create mode 100755 src/PresenceController.ts create mode 100755 src/RoleAllocator.ts create mode 100755 src/RosterContactProvider.ts create mode 100755 src/StateMachine.ts create mode 100755 src/StorableAbstract.ts create mode 100755 src/Storage.interface.ts create mode 100755 src/Storage.ts create mode 100755 src/Transcript.ts create mode 100755 src/UserMedia.ts create mode 100755 src/api/index.ts create mode 100755 src/api/v1/Account.ts create mode 100755 src/api/v1/debug.ts create mode 100755 src/api/v1/disconnect.ts create mode 100755 src/api/v1/index.ts create mode 100755 src/api/v1/register.ts create mode 100755 src/api/v1/start.ts create mode 100755 src/api/v1/testBOSHServer.ts create mode 100755 src/bootstrap/plugins.ts create mode 100755 src/bootstrap/webpackPublicPath.ts create mode 100755 src/connection/AbstractConnection.ts create mode 100755 src/connection/Connection.interface.ts create mode 100755 src/connection/Form.ts create mode 100755 src/connection/FormField.ts create mode 100755 src/connection/FormItemField.ts create mode 100755 src/connection/FormReportedField.ts create mode 100755 src/connection/JingleHandler.ts create mode 100755 src/connection/services/AbstractService.ts create mode 100755 src/connection/services/Disco.ts create mode 100755 src/connection/services/MUC.ts create mode 100755 src/connection/services/PEP.ts create mode 100755 src/connection/services/PubSub.ts create mode 100755 src/connection/services/Roster.ts create mode 100755 src/connection/services/Search.ts create mode 100755 src/connection/services/Vcard.ts create mode 100755 src/connection/storage/Connection.ts create mode 100755 src/connection/xmpp/AbstractHandler.ts create mode 100755 src/connection/xmpp/ConnectHelper.ts create mode 100755 src/connection/xmpp/Connection.ts create mode 100755 src/connection/xmpp/Connector.ts create mode 100755 src/connection/xmpp/JingleHandler.ts create mode 100755 src/connection/xmpp/MessageElement.ts create mode 100755 src/connection/xmpp/handler.ts create mode 100755 src/connection/xmpp/handlers/caps.ts create mode 100755 src/connection/xmpp/handlers/chatMessage.ts create mode 100755 src/connection/xmpp/handlers/disco.ts create mode 100755 src/connection/xmpp/handlers/errorMessage.ts create mode 100755 src/connection/xmpp/handlers/headlineMessage.ts create mode 100755 src/connection/xmpp/handlers/jingle.ts create mode 100755 src/connection/xmpp/handlers/multiUser/DirectInvitation.ts create mode 100755 src/connection/xmpp/handlers/multiUser/Presence.ts create mode 100755 src/connection/xmpp/handlers/multiUser/PresenceProcessor.ts create mode 100755 src/connection/xmpp/handlers/multiUser/StatusCodeHandler.ts create mode 100755 src/connection/xmpp/handlers/multiUser/XMessage.ts create mode 100755 src/connection/xmpp/handlers/multiUser/groupChatMessage.ts create mode 100755 src/connection/xmpp/handlers/presence.ts create mode 100755 src/connection/xmpp/namespace.ts create mode 100755 src/errors/AuthenticationError.ts create mode 100755 src/errors/BaseError.ts create mode 100755 src/errors/ConnectionError.ts create mode 100755 src/errors/InvalidParameterError.ts create mode 100755 src/errors/ParsingError.ts create mode 100755 src/index.ts create mode 100755 src/plugin/AbstractPlugin.ts create mode 100755 src/plugin/EncryptionPlugin.ts create mode 100755 src/plugin/PluginAPI.interface.ts create mode 100755 src/plugin/PluginAPI.ts create mode 100755 src/plugin/PluginRepository.ts create mode 100755 src/plugins/AvatarPEPPlugin.ts create mode 100755 src/plugins/AvatarVCardPlugin.ts create mode 100755 src/plugins/BlockingCommandPlugin.ts create mode 100755 src/plugins/CommandPlugin.ts create mode 100755 src/plugins/JingleMessageInitiationPlugin.ts create mode 100755 src/plugins/LastMessageCorrectionPlugin.ts create mode 100755 src/plugins/MeCommandPlugin.ts create mode 100755 src/plugins/MessageCarbonsPlugin.ts create mode 100755 src/plugins/MessageDeliveryReceiptsPlugin.ts create mode 100755 src/plugins/NotificationPlugin.ts create mode 100755 src/plugins/PingPlugin.ts create mode 100755 src/plugins/TimePlugin.ts create mode 100755 src/plugins/VersionPlugin.ts create mode 100755 src/plugins/bookmarks/BookmarkProvider.ts create mode 100755 src/plugins/bookmarks/BookmarksPlugin.ts create mode 100755 src/plugins/bookmarks/RoomBookmark.ts create mode 100755 src/plugins/bookmarks/services/AbstractService.ts create mode 100755 src/plugins/bookmarks/services/LocalService.ts create mode 100755 src/plugins/bookmarks/services/PubSubService.ts create mode 100755 src/plugins/chatMarkers/ChatMarkersPlugin.ts create mode 100755 src/plugins/chatState/ChatStateConnection.ts create mode 100755 src/plugins/chatState/ChatStateMachine.ts create mode 100755 src/plugins/chatState/ChatStatePlugin.ts create mode 100755 src/plugins/chatState/State.ts create mode 100755 src/plugins/httpUpload/HttpUploadPlugin.ts create mode 100755 src/plugins/httpUpload/HttpUploadService.ts create mode 100755 src/plugins/mam/Archive.ts create mode 100755 src/plugins/mam/Plugin.ts create mode 100755 src/plugins/omemo/AttachmentHandler.ts create mode 100755 src/plugins/omemo/Plugin.ts create mode 100755 src/plugins/omemo/lib/Bootstrap.ts create mode 100755 src/plugins/omemo/lib/Bundle.ts create mode 100755 src/plugins/omemo/lib/BundleManager.ts create mode 100755 src/plugins/omemo/lib/Device.ts create mode 100755 src/plugins/omemo/lib/IdentityManager.ts create mode 100755 src/plugins/omemo/lib/Omemo.ts create mode 100755 src/plugins/omemo/lib/Peer.ts create mode 100755 src/plugins/omemo/lib/Session.ts create mode 100755 src/plugins/omemo/lib/Store.ts create mode 100755 src/plugins/omemo/model/EncryptedDeviceMessage.ts create mode 100755 src/plugins/omemo/model/Exportable.ts create mode 100755 src/plugins/omemo/model/IdentityKey.ts create mode 100755 src/plugins/omemo/model/PreKey.ts create mode 100755 src/plugins/omemo/model/RegistrationId.ts create mode 100755 src/plugins/omemo/model/SignedPreKey.ts create mode 100755 src/plugins/omemo/util/AES.ts create mode 100755 src/plugins/omemo/util/ArrayBuffer.ts create mode 100755 src/plugins/omemo/util/Const.ts create mode 100755 src/plugins/omemo/util/Formatter.ts create mode 100755 src/plugins/omemo/util/Stanza.ts create mode 100755 src/plugins/omemo/vendor/Address.ts create mode 100755 src/plugins/omemo/vendor/KeyHelper.ts create mode 100755 src/plugins/omemo/vendor/SessionBuilder.ts create mode 100755 src/plugins/omemo/vendor/SessionCipher.ts create mode 100755 src/plugins/omemo/vendor/Signal.ts create mode 100755 src/plugins/omemo/vendor/SignalStore.interface.ts create mode 100755 src/plugins/omemo/vendor/SignalStore.ts create mode 100755 src/plugins/otr/Plugin.ts create mode 100755 src/plugins/otr/Session.ts create mode 100755 src/ui/AvatarSet.ts create mode 100755 src/ui/ChatWindow.ts create mode 100755 src/ui/ChatWindowFileTransferHandler.ts create mode 100755 src/ui/ChatWindowList.ts create mode 100755 src/ui/ChatWindowMessage.ts create mode 100755 src/ui/Dialog.ts create mode 100755 src/ui/DialogList.ts create mode 100755 src/ui/DialogListItem.ts create mode 100755 src/ui/DialogNavigation.ts create mode 100755 src/ui/DialogPage.ts create mode 100755 src/ui/DialogSection.ts create mode 100755 src/ui/MenuComponent.ts create mode 100755 src/ui/MultiUserChatWindow.ts create mode 100755 src/ui/Overlay.ts create mode 100755 src/ui/Roster.ts create mode 100755 src/ui/RosterItem.ts create mode 100755 src/ui/VideoDialog.ts create mode 100755 src/ui/VideoWindow.ts create mode 100755 src/ui/actions/call.ts create mode 100755 src/ui/dialogs/about.ts create mode 100755 src/ui/dialogs/avatarupload.ts create mode 100755 src/ui/dialogs/commandHelp.ts create mode 100755 src/ui/dialogs/confirm.ts create mode 100755 src/ui/dialogs/contact.ts create mode 100755 src/ui/dialogs/contactBlock.ts create mode 100755 src/ui/dialogs/contactsearch.ts create mode 100755 src/ui/dialogs/debugLog.ts create mode 100755 src/ui/dialogs/exstatus.ts create mode 100755 src/ui/dialogs/fingerprints.ts create mode 100755 src/ui/dialogs/loginBox.ts create mode 100755 src/ui/dialogs/messageHistory.ts create mode 100755 src/ui/dialogs/multiUserInvitation.ts create mode 100755 src/ui/dialogs/multiUserInvite.ts create mode 100755 src/ui/dialogs/multiUserJoin.ts create mode 100755 src/ui/dialogs/multiUserMemberlist.ts create mode 100755 src/ui/dialogs/multiUserRoomConfiguration.ts create mode 100755 src/ui/dialogs/notification.ts create mode 100755 src/ui/dialogs/omemoDevices.ts create mode 100755 src/ui/dialogs/selection.ts create mode 100755 src/ui/dialogs/settings.ts create mode 100755 src/ui/dialogs/unknownSender.ts create mode 100755 src/ui/dialogs/vcard.ts create mode 100755 src/ui/dialogs/verification.ts create mode 100755 src/ui/util/ByteBeautifier.ts create mode 100755 src/ui/util/DateTime.ts create mode 100755 src/ui/util/ElementHandler.ts create mode 100755 src/ui/util/LongPress.ts create mode 100755 src/ui/util/Menu.ts create mode 100755 src/ui/util/TableElement.ts create mode 100755 src/ui/web.ts create mode 100755 src/util/Color.ts create mode 100755 src/util/FileHelper.ts create mode 100755 src/util/Hash.ts create mode 100755 src/util/HookRepository.ts create mode 100755 src/util/ImageHelper.ts create mode 100755 src/util/Location.ts create mode 100755 src/util/Log.interface.ts create mode 100755 src/util/Log.ts create mode 100755 src/util/PersistentArray.ts create mode 100755 src/util/PersistentMap.ts create mode 100755 src/util/Pipe.ts create mode 100755 src/util/Random.ts create mode 100755 src/util/SortedPersistentMap.ts create mode 100755 src/util/Translation.ts create mode 100755 src/util/UUID.ts create mode 100755 src/util/Utils.ts create mode 100755 src/vendor/Jingle.interface.ts create mode 100755 src/vendor/Strophe.ts create mode 100755 template/about.hbs create mode 100755 template/avatarUploadTemplate.hbs create mode 100755 template/bookmark.hbs create mode 100755 template/chat-window-message.hbs create mode 100755 template/chatWindow.hbs create mode 100755 template/chatWindowList.hbs create mode 100755 template/commandHelpDialog.hbs create mode 100755 template/confirm.hbs create mode 100755 template/contact.hbs create mode 100755 template/contactBlock.hbs create mode 100755 template/contactsearch.hbs create mode 100755 template/debugLog.hbs create mode 100755 template/dialog.hbs create mode 100755 template/dialogOmemoDeviceItem.hbs create mode 100755 template/dialogOmemoDeviceList.hbs create mode 100755 template/extensiveStatus.hbs create mode 100755 template/fingerprints.hbs create mode 100755 template/helpers/breaklines.js create mode 100755 template/helpers/t.js create mode 100755 template/helpers/tr.js create mode 100755 template/loginBox.hbs create mode 100755 template/menu.hbs create mode 100755 template/messageHistory.hbs create mode 100755 template/multiUserInvitation.hbs create mode 100755 template/multiUserInvite.hbs create mode 100755 template/multiUserJoin.hbs create mode 100755 template/multiUserMemberlist.hbs create mode 100755 template/notification.hbs create mode 100755 template/partials/menu.hbs create mode 100755 template/roster-form.hbs create mode 100755 template/roster-item.hbs create mode 100755 template/roster.hbs create mode 100755 template/selection.hbs create mode 100755 template/vcard-body.hbs create mode 100755 template/vcard.hbs create mode 100755 template/verification.hbs create mode 100755 template/videoDialog.hbs create mode 100755 test/AccountStub.ts create mode 100755 test/Client.ts create mode 100755 test/DiscoInfoVersion.spec.ts create mode 100755 test/JID.spec.ts create mode 100755 test/Options.spec.ts create mode 100755 test/Storage.spec.ts create mode 100755 test/connection/Form.spec.ts create mode 100755 test/connection/xmpp/handlers/presence.spec.ts create mode 100755 test/util/HookRepository.spec.ts create mode 100755 test/util/Pipe.spec.ts create mode 100755 test/util/Utils.spec.ts create mode 100755 tsconfig.json create mode 100755 webpack.config.js create mode 100755 yarn.lock [root@yfw jsxc-master]# sudo -u www yarn build yarn run v1.22.22 warning ../../package.json: No license field $ webpack --progress --config webpack.config.js --mode production 10% building 0/2 entries 2/2 dependencies 0/2 modulesDeprecation Warning: Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0. Recommendation: math.div($grid-gutter-width, 2) or calc($grid-gutter-width / 2) More info and automated migrator: https://sass-lang.com/d/slash-div ╷ 368 │ $navbar-padding-horizontal: floor(($grid-gutter-width / 2)) !default; │ ^^^^^^^^^^^^^^^^^^^^^^ ╵ node_modules/bootstrap-sass/assets/stylesheets/bootstrap/_variables.scss 368:43 @import scss/vendor/_all.scss 25:9 @import scss/main.scss 13:9 root stylesheet Deprecation Warning: Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0. Recommendation: math.div($navbar-height - $line-height-computed, 2) or calc(($navbar-height - $line-height-computed) / 2) More info and automated migrator: https://sass-lang.com/d/slash-div ╷ 369 │ $navbar-padding-vertical: (($navbar-height - $line-height-computed) / 2) !default; │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ╵ node_modules/bootstrap-sass/assets/stylesheets/bootstrap/_variables.scss 369:37 @import scss/vendor/_all.scss 25:9 @import scss/main.scss 13:9 root stylesheet Deprecation Warning: Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0. Recommendation: math.div($line-height-computed - 1, 2) or calc(($line-height-computed - 1) / 2) More info and automated migrator: https://sass-lang.com/d/slash-div ╷ 43 │ padding: (($line-height-computed - 1) / 2); │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ╵ node_modules/bootstrap-sass/assets/stylesheets/bootstrap/_code.scss 43:13 @import scss/vendor/_all.scss 51:11 @import scss/main.scss 13:9 root stylesheet Deprecation Warning: Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0. Recommendation: math.div($line-height-computed, 2) or calc($line-height-computed / 2) More info and automated migrator: https://sass-lang.com/d/slash-div ╷ 44 │ margin: 0 0 ($line-height-computed / 2); │ ^^^^^^^^^^^^^^^^^^^^^^^^^ ╵ node_modules/bootstrap-sass/assets/stylesheets/bootstrap/_code.scss 44:16 @import scss/vendor/_all.scss 51:11 @import scss/main.scss 13:9 root stylesheet Deprecation Warning: Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0. Recommendation: math.div($gutter, 2) or calc($gutter / 2) More info and automated migrator: https://sass-lang.com/d/slash-div ╷ 7 │ padding-right: ceil(($gutter / 2)); │ ^^^^^^^^^^^ ╵ node_modules/bootstrap-sass/assets/stylesheets/bootstrap/mixins/_grid.scss 7:24 container-fixed() node_modules/bootstrap-sass/assets/stylesheets/bootstrap/_grid.scss 11:3 @import scss/vendor/_all.scss 52:11 @import scss/main.scss 13:9 root stylesheet Warning: 10 repetitive deprecation warnings omitted. assets by path images/emojione/*.svg 3.05 MiB 1832 assets assets by path images/icons/*.svg 95.1 KiB 42 assets assets by path images/filetypes/ 29.9 KiB 40 assets assets by path images/*.svg 14.8 KiB 9 assets assets by path assets/ 145 KiB 6 assets assets by path images/emoticons/*.svg 36.7 KiB 6 assets assets by path images/presence/*.svg 9.21 KiB 5 assets assets by path fonts/ 28 KiB 4 assets assets by chunk 2.7 MiB (name: main) asset jsxc.bundle.js 2.44 MiB [emitted] [minimized] (name: main) 1 related asset asset styles/jsxc.bundle.css 264 KiB [emitted] (name: main) asset images/XMPP_logo.png 9.35 KiB [emitted] [from: images/XMPP_logo.png] [copied] asset images/loading.gif 2.7 KiB [emitted] [from: images/loading.gif] [copied] asset LICENSE 1.08 KiB [emitted] [from: LICENSE] [copied] Entrypoint main 2.7 MiB (145 KiB) = styles/jsxc.bundle.css 264 KiB jsxc.bundle.js 2.44 MiB 6 auxiliary assets orphan modules 139 KiB [orphan] 27 modules runtime modules 1.65 KiB 9 modules javascript modules 4.35 MiB modules by path ./node_modules/ 3.14 MiB 268 modules modules by path ./src/ 1.11 MiB 226 modules modules by path ./template/ 95.6 KiB modules by path ./template/*.hbs 95.1 KiB 30 modules modules by path ./template/helpers/*.js 535 bytes 2 modules modules by path ./sound/*.mp3 239 bytes 3 modules modules by path ./images/ 168 bytes ./images/XMPP_logo.png 80 bytes [built] [code generated] ./images/icons/placeholder.svg 88 bytes [built] [code generated] json modules 461 KiB 30 modules css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/sass-loader/dist/cjs.js!./scss/main.scss 263 KiB [built] [code generated] WARNING in ./node_modules/strophe.js/dist/strophe.umd.js 66:44-71 Module not found: Error: Can't resolve 'xmldom' in '/www/wwwroot/szrengjing.com/jsxc/jsxc-master/node_modules/strophe.js/dist' @ ./src/vendor/Strophe.ts 4:17-38 @ ./src/plugins/MessageDeliveryReceiptsPlugin.ts 22:16-44 @ ./src/bootstrap/plugins.ts 5:38-89 @ ./src/index.ts 3:0-30 1 warning has detailed information that is not shown. Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it. webpack 5.65.0 compiled with 1 warning in 38502 ms Done in 40.43s. [root@yfw jsxc-master]# yarn build --bundleAnalyzer yarn run v1.22.22 warning ../../package.json: No license field $ webpack --progress --config webpack.config.js --mode production --bundleAnalyzer [webpack-cli] Error: Unknown option '--bundleAnalyzer' [webpack-cli] Run 'webpack --help' to see available commands and options error Command failed with exit code 2. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. [root@yfw jsxc-master]# sudo -u www yarn build -- --bundleAnalyzer yarn run v1.22.22 warning ../../package.json: No license field warning From Yarn 1.0 onwards, scripts don't require "--" for options to be forwarded. In a future version, any explicit "--" will be forwarded as-is to the scripts. $ webpack --progress --config webpack.config.js --mode production --bundleAnalyzer [webpack-cli] Error: Unknown option '--bundleAnalyzer' [webpack-cli] Run 'webpack --help' to see available commands and options error Command failed with exit code 2. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. [root@yfw jsxc-master]# sudo -u www yarn build:analyze yarn run v1.22.22 warning ../../package.json: No license field error Command "build:analyze" not found. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. [root@yfw jsxc-master]#
最新发布
11-11
"F:\software Anaconda\envs\pythonProject2\python.exe" D:/我的作业/作业/pythonProject2/SCUNet-main/SCUNet-main/main_test_scunet_gray_gaussian.py LogHandlers setup! F:\software Anaconda\envs\pythonProject2\lib\site-packages\timm\models\layers\__init__.py:48: FutureWarning: Importing from timm.models.layers is deprecated, please import via timm.layers warnings.warn(f"Importing from {__name__} is deprecated, please import via timm.layers", FutureWarning) Block Initial Type: W, drop_path_rate:0.000000 Block Initial Type: SW, drop_path_rate:0.000000 Block Initial Type: W, drop_path_rate:0.000000 Block Initial Type: SW, drop_path_rate:0.000000 Block Initial Type: W, drop_path_rate:0.000000 Block Initial Type: SW, drop_path_rate:0.000000 Block Initial Type: W, drop_path_rate:0.000000 Block Initial Type: SW, drop_path_rate:0.000000 Block Initial Type: W, drop_path_rate:0.000000 Block Initial Type: SW, drop_path_rate:0.000000 Block Initial Type: W, drop_path_rate:0.000000 Block Initial Type: SW, drop_path_rate:0.000000 Block Initial Type: W, drop_path_rate:0.000000 Block Initial Type: SW, drop_path_rate:0.000000 Block Initial Type: W, drop_path_rate:0.000000 Block Initial Type: SW, drop_path_rate:0.000000 Block Initial Type: W, drop_path_rate:0.000000 Block Initial Type: SW, drop_path_rate:0.000000 Block Initial Type: W, drop_path_rate:0.000000 Block Initial Type: SW, drop_path_rate:0.000000 Block Initial Type: W, drop_path_rate:0.000000 Block Initial Type: SW, drop_path_rate:0.000000 Block Initial Type: W, drop_path_rate:0.000000 Block Initial Type: SW, drop_path_rate:0.000000 Block Initial Type: W, drop_path_rate:0.000000 Traceback (most recent call last): File "D:\我的作业\作业\pythonProject2\SCUNet-main\SCUNet-main\main_test_scunet_gray_gaussian.py", line 156, in <module> main() File "D:\我的作业\作业\pythonProject2\SCUNet-main\SCUNet-main\main_test_scunet_gray_gaussian.py", line 70, in main model.load_state_dict(torch.load(model_path), strict=True) File "F:\software Anaconda\envs\pythonProject2\lib\site-packages\torch\serialization.py", line 1479, in load with _open_file_like(f, "rb") as opened_file: File "F:\software Anaconda\envs\pythonProject2\lib\site-packages\torch\serialization.py", line 759, in _open_file_like return _open_file(name_or_buffer, mode) File "F:\software Anaconda\envs\pythonProject2\lib\site-packages\torch\serialization.py", line 740, in __init__ super().__init__(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: 'model_zoo\\scunet_gray_25.pth' Block Initial Type: SW, drop_path_rate:0.000000 Block Initial Type: W, drop_path_rate:0.000000 Block Initial Type: SW, drop_path_rate:0.000000报错为上述应该怎么处理
07-15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值